Page MenuHomePhabricator

Map geosearch results to GeoJSON or another appropriate format
Closed, ResolvedPublic3 Estimated Story Points

Description

Take the results of the geosearch API and reformat as geojson—or if Leaflet desires another data structure, use that. Include the image and title so that clicking on the marker will look somewhat like a page preview popup.

It's possible that this logic already exists somewhere, for example in the iOS app.

Dev note: No further styling is needed for this first step (e.g. no colors for the markers).

Example geosearch query: https://de.m.wikipedia.org/w/api.php?action=query&format=json&formatversion=2&prop=coordinates|pageprops|pageprops|pageimages|description&colimit=max&generator=geosearch&ggsradius=10000&ggsnamespace=0&ggslimit=50&ggscoord=52.5583|13.3826&ppprop=displaytitle&piprop=thumbnail&pithumbsize=150&pilimit=50&codistancefrompoint=52.5583|13.3822

Responds with:

{
  "batchcomplete": true,
  "query": {
    "pages": [
      {
        "pageid": 882752,
        "ns": 0,
        "title": "Lüdersdorffstraße",
        "index": -1,
        "coordinates": [
          {
            "lat": 52.55,
            "lon": 13.37361111,
            "primary": true,
            "globe": "earth",
            "dist": 1090.4
          }
        ],
        "description": "historischer Straßenname im Berliner Ortsteil Weißensee",
        "descriptionsource": "central"
      },
      {
        "pageid": 1075507,
        "ns": 0,
        "title": "Jüdisches Krankenhaus Berlin",
        "index": 0,
        "coordinates": [
          {
            "lat": 52.55555556,
            "lon": 13.37055556,
            "primary": true,
            "globe": "earth",
            "dist": 844.3
          }
        ],
        "thumbnail": {
          "source": "https://upload.wikimedia.org/wikipedia/commons/thumb/9/9a/Gesundbrunnen_Iranische_Stra%C3%9Fe_Iranische_Stra%C3%9Fe_2_Krankenhaus_der_J%C3%BCdischen_Gemeinde.jpg/150px-Gesundbrunnen_Iranische_Stra%C3%9Fe_Iranische_Stra%C3%9Fe_2_Krankenhaus_der_J%C3%BCdischen_Gemeinde.jpg",
          "width": 150,
          "height": 103
        },
        "description": "Krankenhaus in Berlin-Gesundbrunnen",
        "descriptionsource": "central"
      },
      ...

Event Timeline

awight updated the task description. (Show Details)
thiemowmde set the point value for this task to 3.
awight renamed this task from Map geosearch results to geojson markers to Map geosearch results to GeoJSON or another appropriate format.Apr 14 2022, 1:34 PM
awight updated the task description. (Show Details)

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

[mediawiki/extensions/Kartographer@master] [WIP] Convert nearby results to GeoJSON and render

https://gerrit.wikimedia.org/r/780870

Change 780870 merged by jenkins-bot:

[mediawiki/extensions/Kartographer@master] Convert nearby results to GeoJSON and render

https://gerrit.wikimedia.org/r/780870