I have a lot of GPS coordinates. How can I find the respective element id according the GPS data? (I can not use the webpage and per the mouse click on the query button, since I have too many points...) For example: Given this GPS coordinate: [51.645401, 12.052744] Return the element id: farmland #6249468 How can I do that? asked 09 Feb '17, 16:12 xirururu |
The query button on the website is implemented using a publicly available service, Overpass-API: http://wiki.openstreetmap.org/wiki/Overpass_API There is some discussion of it in the website code: (the query language used there is documented at http://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL ) You can experiment with Overpass-API using a convenient gui at Overpass Turbo: http://overpass-turbo.eu/s/mC9 I've only added a piece of the query there, the is_in operator returns a subset of nearby objects, you'd need to add the around operators and experiment a bit to see if the output is useful for what you need. answered 09 Feb '17, 23:52 maxerickson @maxerickson Thanks so much for the answer! Run your is_in() function works perfectly. But how can I write the nearby function? According your query.js file, I made the nearby function. But it doesn't work. (node(around:100, 51.645401, 12.052744); way(around:100, 51.645401, 12.052744)); out tags; relation(around:10, 51.645401, 12.052744); out; Here is my code in overpass-turbo
(10 Feb '17, 01:34)
xirururu
There are no features within the 100 meter radius. Increasing it returns some features (200 works for nodes). Also get rid of the
(10 Feb '17, 03:12)
maxerickson
@maxerickson Thanks! I still have a little doubt, The gps point [51.645401, 12.052744] is actually in the "Farmland #6249468", but why it returned as a nearby feature?
(10 Feb '17, 10:56)
xirururu
The areas that the is_in operator returns are generated by Overpass API using a set of rules. For landuse types (and most other features), they are only included as areas if they have a name. The rules are here: https://github.com/drolbr/Overpass-API/blob/master/src/rules/areas.osm3s
(10 Feb '17, 13:32)
maxerickson
|