On Mon, May 1, 2017 at 7:14 PM, Bjoern Hassler <bjohas...@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.


-- 
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

Reply via email to