Search code examples
web-servicesgeonames

Querying geonames for rows 1000-1200


I have been querying Geonames for parks per state. Mostly there are under 1000 parks per state, but I just queried Conneticut, and there are just under 1200 parks there.

I already got the 1-1000 with this query:

http://api.geonames.org/search?featureCode=PRK&username=demo&country=US&style=full&adminCode1=CT&maxRows=1000

But increasing the maxRows to 1200 gives an error that I am querying for too many at once. Is there a way to query for rows 1000-1200 ?

I don't really see how to do it with their API.

Thanks!


Solution

  • You should be using the startRow parameter in the query to page results. The documentation notes that it takes an integer value (0 based indexing) and should be

    Used for paging results. If you want to get results 30 to 40, use startRow=30 and maxRows=10. Default is 0.

    So to get the next 1000 data points (1000-1999), you should change your query to

    http://api.geonames.org/search?featureCode=PRK&username=demo&country=US&style=full&adminCode1=CT&maxRows=1000&startRow=1000
    

    I'd suggest reducing the maxRows to something manageable as well - something that will put less of a load on their servers and make for quicker responses to your queries.