Page MenuHomePhabricator

Inconsistency between requested `gsbbox` values and `geosearch` query results
Open, NormalPublic

Description

There is an inconsistency between the values given with the gsbbox parameter and the results of the geosearch query.
The de-fact bounding box seems to be significantly different than the xmin and xmax values used in the gsbbox parameter.

For example, the output of a query using gsbbox=37.8|-122.3|37.7|-122.4 includes includes a result with "lon": 57.63055555555555

{
  "pageid": 35718195,
  "ns": 0,
  "title": "Qaleh-ye Ali Mohammad",
  "lat": 37.75055555555556,
  "lon": 57.63055555555555,
  "dist": 1710.7,
  "primary": ""
},

Similarly, the output of a query using gsbbox=30.41|145.05|30.33|145.03 includes a result with "lon": -9.69:

{
  "pageid": 9464907,
  "ns": 0,
  "title": "1960 Agadir earthquake",
  "lat": 30.35,
  "lon": -9.69,
  "dist": 2419479.9,
  "primary": ""
},

The shift in the first example seems to be about +180 and the shift in the second example is about -155.

This may or may not be related to the unconventional coordinate order of gsbbox - ymax|xmax|ymin|xmin.

Event Timeline

Restricted Application added a project: Discovery-Search. · View Herald TranscriptMon, Oct 7, 6:06 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Aklapper renamed this task from Inconsistecy between the requested `gsbbox` values and the `geosearch` query results to Inconsistency between requested `gsbbox` values and `geosearch` query results.Mon, Oct 7, 7:08 AM
This comment was removed by IsraelHikingMap.
IsraelHikingMap updated the task description. (Show Details)
EBernhardson triaged this task as Normal priority.Thu, Oct 10, 8:34 PM
EBernhardson added a subscriber: EBernhardson.

This looks to be a problem with coordinate ordering, geodata needs to ensure when setting the top left and bottom right coordinates of the bounding box that it's actually using the left and right. It looks like geodata is intending for the input to be (lat_1,lon_1), (lat_2,lon_2). but then passes that directly as the bounding box edges without ensuring appropriate ordering.

IsraelHikingMap added a comment.EditedFri, Oct 11, 8:52 PM

Indeed, the geosearch by bounding box works fine by using ymax|xmin|ymin|xmax or top|left|bottom|right.

For example, the output of a query using gsbbox=48.8531|2.349|48.85|2.3499 includes a result with "lon": 2.3498

{
  "pageid": 62233,
  "ns": 0,
  "title": "Notre-Dame de Paris",
  "lat": 48.853,
  "lon": 2.3498,
  "dist": 163.3,
  "primary": ""
},

I have updated https://www.mediawiki.org/wiki/Extension:GeoData#list%3Dgeosearch accordingly.

The auto-generated documentation at https://en.wikipedia.org/w/api.php?action=help&modules=query+geosearch can also be made more clear, but I was unable to find its source.