Hi, I want to check for thousands of points (lat, lon), if they are located inside a building polygon using the overpass API. I know how to do it for one point (eg: https://help.openstreetmap.org/questions/55529/how-to-detect-if-point-is-inside-a-building-polygon-with-overpass) but I don't know how to do it without sending requests during hours to the overpass API. I'm currently using this request for one point:
where I check gradually up until 25 meters for close buildings. I don't think there is a tool in overpass for checking if the point at lat, lon is located inside any of the close buildings (except creating temporary areas and using is_in?). So, I use the shapely python library for that. The full process for the thousand points takes hours. How could I do it efficiently? I could query all the close buildings of all the points in one request but I don't know how to keep a reference to the node from which a building is close. Thus, I will be forced to check if a node is inside any buildings that I got, no matter from which node the building is close. In this case, it will also not be efficient. Does anyone have an idea for the query to use? Or on how to keep the reference? Thanks! Vucod The full code:
asked 26 Apr, 12:59 Vucod |
I finally found the way to do it in one request which is a lot faster. I just use my request for every point and I separate each sub request by a The full code using python3 :
answered 02 May, 19:51 Vucod |
There's not a contains operation in the Overpass-API query language.
You can inject text into the result using the
make
statement: https://dev.overpass-api.de/blog/textual_data.html