Page MenuHomePhabricator

Nearby feature for maps
Open, Needs TriagePublic


Inspired by the Special:Nearby we want to add the option to display nearby articles in a Kartographer map at an article page.

nearby.gif (512×465 px, 191 KB)

Requirements (MVP)

  • Implement behind a feature flag
  • Add a button to dynamic maps, to show a “nearby” layer. Always disabled by default.
  • Display a map marker for other articles geolocated within the currently shown map area
  • Style map markers to match Kartographer and show as separate from user-added markers (UX to make ticket)
  • Use geosearch API as the source of articles (show only articles from current wiki)
  • When marker is clicked, the standard pop-up appears with the article name shown as a linked title and the description has the short description (from wikidata) and the page preview image. It behaves like current marker pop-ups. Example:
    nearby.png (339×284 px, 97 KB)
  • Show the most relevant (determined by CirrusSearch) articles T307208
  • Determine maximum radius (and expand as far as possible)
  • Add refresh button to show new results after the user has moved within the map to change the bounding box
  • Desktop only, do not add feature to mobile yet (hide on mobile)

Out of scope

  • Static maps

Open questions

  • Find out as early as possible if the planned feature implementation requires a security and/or performance review.
  • How do the other tools get their data? Check for caching mechanisms.

Next steps (post-MVP):

  • Pin grouping T308227
  • Determine possibility for mobile support
  • Accessibility: how to show results as a list
  • Investigate if auto-refresh is possible T308235
  • Potentially: Improve styling of pop-up/article preview

Related tools

WikiShootMe, Wikinity, Wikimap, Geopedia, WIWOSM (docs)

See also:

Related Objects

Event Timeline

Tacsipacsi added a subscriber: Tacsipacsi.

Special:Nearby doesn’t have a map currently, although it has been requested (T303813). I don’t know if the performance considerations over there apply here, but please make sure not to bring down the servers.

Also very much related, the current nearby api of Wikivoyage, which really really needs replacing for multiple reasons: T90645: A better Nearby for Wikivoyage

Additionally, T247600: Create a leaflet geosearch module and publish it is the frontend part of a similar request.

And already features a plugin which queries the GeoData Geosearch api

Something that requires some thought will be to determine what to do with all the potential sources of truth:

  • Wikidata geolocation per item
  • MediaWiki "primary coordinates" per page as collected by GeoData
  • MediaWiki "primary and secondary coordinates" (also collects other coords from pages, which is more suitable for showing all items listed on a specific page, for which there are multiple tools)
  • MediaWiki shapes
  • OSM ids/relations


BTW. If we really are building a new geosearch api, it'd put some thought into "generalising" this in a POI api of which we can have multiple views. We have seen in the past:

  1. Nearby Commons images view
  2. Nearby Wikipedia articles
  3. Nearby Points of interest as listed in a Wikivoyage article
  4. Nearby locations without an article in language X
  5. Nearby locations with articles but without images

I'm not saying all of that should be shoved into this api immediately, but thinking where such oft required views, often shown by tools, would fit in and be able to scale might be a good exercise before committing on new paths.

BTW. If we really are building a new geosearch api, it'd put some thought into "generalising" this in a POI api of which we can have multiple views. We have seen in the past:

I love these suggestions and would like to keep the conversation going, but in this particular task and phase of our work we plan to reuse the existing geosearch API with no improvements. Any thoughts you'd like to put into a new or existing task would be much appreciated!

We found that this will conflict with the built-in Wikivoyage nearby feature, as can be seen in this screenshot:

Screenshot from 2022-04-13 14-37-38.png (807×501 px, 73 KB)

The first iteration can hide our new feature when the built-in nearby is enabled. We should definitely kill the existing feature in favor of the new thing we're building. But we still may want to integrate into this layer menu rather than create a new button elsewhere in the interface.

Change 780784 had a related patch set uploaded (by Awight; author: Awight):

[mediawiki/extensions/Kartographer@master] Nearby feature flag and toggle button

Change 784702 had a related patch set uploaded (by WMDE-Fisch; author: WMDE-Fisch):

[operations/mediawiki-config@master] [beta] Enable Kartographer nearby feature on beta cluster

Change 784702 merged by jenkins-bot:

[operations/mediawiki-config@master] [beta] Enable Kartographer nearby feature on beta cluster

Linking the task T137940: Migrate {{geo}} to use Wikidata coordinates, there has been some discussion about merging the GeoData coordinates with Wikidata coordinates.