Page MenuHomePhabricator

geosearch API query does not return matching page in commons.wikipedia.org
Closed, InvalidPublic

Description

How to reproduce:
Navigate to https://commons.wikimedia.org/w/api.php?action=query&generator=geosearch&ggsradius=100&ggscoord=49.18501717|16.59865617&prop=coordinates|pageimages

Actual result:

{
    "batchcomplete": ""
}

Expected result:
List with properties of one or more images.

More info:
There is a page with image with coordinates from request:
https://commons.wikimedia.org/wiki/File:Rozlou%C4%8Den%C3%AD_s_Kometou_2011_(061).jpg

I see its coordinates in commonswiki-20181220-geo_tags.sql.gz:

(344385674,18861692,'earth',1,49.18501717,16.59865617,1000,'camera',NULL,NULL,NULL)

And the page properties from commonswiki-20181220-page.sql.gz

(18861692,6,'Rozloučení_s_Kometou_2011_(061).jpg','',0,0,0.075091858081,'20181204084640','20181202054558',101879891,819,0,'wikitext',NULL)

Without generator I get similar result:
Request:
https://commons.wikimedia.org/w/api.php?action=query&list=geosearch&gsradius=100&gscoord=49.18501717|16.59865617&prop=coordinates|pageimages

Result:

{
    "batchcomplete": "",
    "query": {
        "geosearch": []
    }
}

Event Timeline

Not sure which project tags apply here, someone please correct. General docs: https://www.mediawiki.org/wiki/API:Showing_nearby_wiki_information

https://commons.wikimedia.org/w/api.php?action=query&generator=geosearch&ggsradius=100&ggscoord=49.18501717|16.59865617&prop=coordinates|pageimages

No results either when increasing to ggsradius=10000 so the query itself is the issue, not the image or image info.

If I explicitly set the [namespace for File:](https://commons.wikimedia.org/wiki/Help:Namespaces) and increase ggsradius a bit I get results at least, though it does not include the image you expected above:
https://commons.wikimedia.org/w/api.php?action=query&generator=geosearch&ggsradius=150&ggscoord=49.18501717|16.59865617&prop=coordinates|pageimages&ggsnamespace=6

Anomie closed this task as Invalid.EditedJan 16 2019, 4:23 PM
Anomie subscribed.

It looks like this edit to Module:Coordinates broke some stuff. The bit relevant to this task is that args.namespace is 'File' but the code is now looking for 'file' (lowercase). I guess Jarekt got confused, he added code to the getArgs() function to lowercase name but then changed the rest of the code as if he had lowercased value.

The 20181220 geo_tag dump likely still had coordinates because the page hadn't been reparsed since the change to Module:Coordinates. Since then, the job queue must have gotten around to reparsing it.

Marking this task Invalid as there's no bug in MediaWiki or the GeoData extension here. The error in the module should be discussed and fixed on-wiki.

@Anomie I do not fully understand your answer and why the task is invalid, so could you please explain, what should I do do find the aforementioned image using geosearch API?

You should fix (or have someone else fix) the bug in https://commons.wikimedia.org/wiki/Module:Coordinates, and then probably null-edit the image so you don't have to wait for the job queue to reparse it again. For images in general, though, you'll have to wait for the job queue to update them all.

The task is invalid because Phabricator, or at least the tags used on this task, is for tracking issues with the code of MediaWiki and its extensions. In this case the issue is entirely with the on-wiki Module:Coordinates.

I have no idea what is wrong, so I reverted Module:Coordinates to earlier version.

According to documentation at https://www.mediawiki.org/wiki/API:Geosearch we do not need to specify namespace for geosearch query. Does it mean there is still a bug or the documentation needs to be updated?

The default value for gsnamespace is 0 (the main article namespace), which works well for most wikis. But if you're looking for geotagged files, you need to search the File namespace (6) instead. Whether the documentation actually needs updating for that I don't know, but there's no bug.

Thanks for explanation. I expected that if namespace is not specified, API would not filter results by namespace.