I have an OSM map of a larger region. Inside that region is a city with a boundary specified by a polygon.

I want to retrieve IDs of all ways (ideally - of all buildings) inside that boundary (inside the red polygon in the screenshot below).

Artyom city

How can I do it (ideally - in Java) ?


2 Answers 2


Instead of downloading all the data, you can use the Overpass API to do a selective extract based on a bounding box and certain properties (for example, a key-value search for certain properties).

What properties you choose to use is (of course) your choice - I assume you already have something you're using as the definition of a "building" based on the key-value pairs in the API output, since this is a bit qualitative (e.g. is a bus shelter a building?)

If you'd like to install that system locally, see http://wiki.openstreetmap.org/wiki/Overpass_API/versions


I have same need. Till now i have this overpass query

way(poly:"50.7 7.1 50.7 7.2 50.75 7.15")[building];
out ids;



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.