Hello, on Overpass when I make query and ask for "raw data directly from Overpass API" I get a JSON that contains some extra data that I do not need. For example see the following query:
I would like to get all nodes/way/relation that have tag But I get a lot of extra data, such as nodes that are a part of way/relation and ways that are a part of relation and relations theirself as well. So, is it possibile to get just one occurence for every "entity" (node or way or relation) that has some given properties? How to reach that? asked 04 Mar '19, 18:00 Andreanovenove |
Remove ">;" from every line and you should get what you request. That statement substantially means "get all the objects referenced by the one you have found". For more info: https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#Recurse_down_.28.3E.29 answered 05 Mar '19, 10:44 MarcoR Thank you for your reply. Yes, it works, but I would like to get a couple of coordinates for every point (node/way/relation). I know that a way or relation could have several coordinates, do you know if is it possible to get just one couple of lat and lon for every object? Then every object should have "type", "id", "lat", "lon" and "tags".
(05 Mar '19, 18:23)
Andreanovenove
1
Try It calculates the center of the bounding box of the feature or so, so it might not work if you want a better centroid than that.
(05 Mar '19, 19:46)
maxerickson
I did see it, from here: https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#Standalone_queries. Do you know what does the note mean? "Note: The center point is not guaranteed to lie inside the polygon". Anyway it seems to work but I have to double check it. Thank you so much for your help!
(05 Mar '19, 20:06)
Andreanovenove
That's what maxerickson was talking about. Think about an object shaped like a horseshoe. The centre of the bounding box would be in the middle of the open area, not inside the actual area of the object.
(05 Mar '19, 21:45)
alester
Oh, I see. The horseshoe example opens my mind about the meaning of that note. Thank you. Do you know a way to get just the first couple of coordinates or any of the nodes' coordinates corrisponding to a way/relation instead of calculated center?
(06 Mar '19, 17:22)
Andreanovenove
|