This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

How to query all changesets by a user since eternity?

7
2

The main api only returns 100 changesets, but the user has more than that, how can all of their changeset be queried?

asked 07 Jun '13, 07:47

amritkarma's gravatar image

amritkarma
684212941
accept rate: 11%


One Answer:

10

You would have to get them 100 at a time. For example

http://api.openstreetmap.org/api/0.6/changesets?display_name=EdLoach

returns my most recent 100 changesets. My 100th changeset (as I type) shows created_at="2013-04-19T09:29:30Z" So, my next 100 older changesets can be queried by:

http://api.openstreetmap.org/api/0.6/changesets?display_name=EdLoach&time=2001-01-01,2013-04-19T09:29:30Z

where the first time is "closed after" and the second time is "created before", so I picked an arbitrary "closed after" date before the project began. So to get the next 100 older changesets each time, use the created_by time from the last changeset returned from the previous query as the "created before" time for the next one. At some point you will either get fewer than 100 changesets returned, or an empty result (example here based on a "created before" date set before I began mapping) if a user has an exact multiple of 100 changesets.

answered 07 Jun '13, 08:43

EdLoach's gravatar image

EdLoach ♦
19.5k16156280
accept rate: 22%

2

But see the https://wiki.openstreetmap.org/wiki/API_usage_policy and don't do this for many users.

(07 Jun '13, 10:02) gormo

I wrote a script to query this API to obtain all changesets for a user https://github.com/andrewharvey/osm-get-user-changeset-metadata

(02 Nov '20, 21:47) aharvey

Source code available on GitHub .