Reputation: 1556
For instance, the following page has the coordinates at the top of the page:
https://en.wikipedia.org/?curid=5839303
and I am able to retrieve them via the API
https://en.wikipedia.org/w/api.php?format=json&action=query&prop=coordinates&pageids=5839303
However this page:
https://en.wikipedia.org/?curid=56846583
Has the coordinates in an infobox and not at the top of the page. I am unable to retrieve them via the API:
https://en.wikipedia.org/w/api.php?format=json&action=query&prop=coordinates&pageids=56846583
Does anyone know why this behaviour occurs and whether it's possible to retrieve the coordinates from my second example via the API?
Upvotes: 1
Views: 169
Reputation: 357
Only 10 coordinates are returned, even if your wider query requests more than 10 search results
Documentation for the coordinates parameters
For example, if you were trying to perform a geographical search and you've set the ggslimit
limit to 20, to retrieve up to 20 results; you also need to set the colimit
to 20, otherwise you will only get coordinates returned for the first default 10 results.
Example query
Upvotes: 0
Reputation: 9096
prop=coordinates, by default, only returns the primary coordinate of the page. Try adding coprimary=all
to your query:
https://en.wikipedia.org/w/api.php?format=json&action=query&prop=coordinates&pageids=56846583&coprimary=all
Upvotes: 1