Hi all,
not sure whether this is an API issue, or something to do with the way coordinates are stored.
If you look at this query, you'll see that for some of the pages coordinates are listed, for others they are not:
https://de.wikipedia.org/w/api.php?action=query&prop=coordinates&gen...
However, quite a few pages do have coordinates on the corresponding wikipedia page, e.g. https://de.wikipedia.org/wiki/Cornia_Nou
Any ideas what that might be?
(As an aside, just in case it's related: How do coordinates end up in Wikidata? I assume it's a bot? Presumably the bot uses the API? Some of the above pages have got coordinates on the page, but not in Wikidata...)
Thanks! Bjoern
On Mon, May 1, 2017 at 7:14 PM, Bjoern Hassler bjohas+mw@gmail.com wrote:
not sure whether this is an API issue, or something to do with the way coordinates are stored.
Neither.
If you look at this query, you'll see that for some of the pages coordinates are listed, for others they are not:
https://de.wikipedia.org/w/api.php?action=query&prop= coordinates&generator=categorymembers&gcmtitle=Kategorie:Ur-_und_Fr%C3% BChgeschichte_(Menorca)&gcmlimit=500 https://de.wikipedia.org/w/api.php?action=query&prop=coordinates&generator=categorymembers&gcmtitle=Kategorie:Ur-_und_Fr%C3%BChgeschichte_%28Menorca%29&gcmlimit=500
That's because you're leaving colimit at its default of 10 and there are more than 10 pages with coordinates in the request, so you'll need to use query continuation to fetch the rest of the data and merge it in. See https://www.mediawiki.org/wiki/API:Query#Continuing_queries. You might also specify a larger limit, e.g. colimit=500 or colimit=max, to reduce the need for continuation.
Another thing to watch for is that there are two types of coordinates, "primary" and "secondary". By default, only primary coordinates are returned. If you need secondary coordinates as well, you'll need to specify coprimary=all in your request.
Hi Brad,
ahhh - that makes sense! Many thanks for the tips, that's great!
Bjoern
On 2 May 2017 at 15:19, Brad Jorsch (Anomie) bjorsch@wikimedia.org wrote:
On Mon, May 1, 2017 at 7:14 PM, Bjoern Hassler bjohas+mw@gmail.com wrote:
not sure whether this is an API issue, or something to do with the way coordinates are stored.
Neither.
If you look at this query, you'll see that for some of the pages coordinates are listed, for others they are not:
https://de.wikipedia.org/w/api.php?action=query&prop=coordin ates&generator=categorymembers&gcmtitle=Kategorie:Ur-_und_ Fr%C3%BChgeschichte_(Menorca)&gcmlimit=500 https://de.wikipedia.org/w/api.php?action=query&prop=coordinates&generator=categorymembers&gcmtitle=Kategorie:Ur-_und_Fr%C3%BChgeschichte_%28Menorca%29&gcmlimit=500
That's because you're leaving colimit at its default of 10 and there are more than 10 pages with coordinates in the request, so you'll need to use query continuation to fetch the rest of the data and merge it in. See https://www.mediawiki.org/wiki/API:Query#Continuing_queries. You might also specify a larger limit, e.g. colimit=500 or colimit=max, to reduce the need for continuation.
Another thing to watch for is that there are two types of coordinates, "primary" and "secondary". By default, only primary coordinates are returned. If you need secondary coordinates as well, you'll need to specify coprimary=all in your request.
-- Brad Jorsch (Anomie) Senior Software Engineer Wikimedia Foundation
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
mediawiki-api@lists.wikimedia.org