I need to extract some administrative boundaries from big OSM extract, and put them in .poly file. Are there any tools for this task?

I've tried Perl script by Gary68 (http://svn.openstreetmap.org/applications/utils/gary68/boundaries.pl), but it returned something like ERROR: at least one needed node missing in osm file. ERROR: at least one needed way missing in osm file. ERROR: at least one needed node or way missing.

Also I've installed osmium, but I don't see tool for my task.

What would you advise me?

(Basically I need to get a list of all houses on all streets of a certain city, and do it automatically for number of cities)

  • Ok, added the link.
    – Alexander
    Feb 9 '14 at 7:28

The perl script by Gary68 is outdated, because Openstreetmap has skipped the 32bit limit on node numbers, and Gary68 does not maintain his scripts anymore.

You can use osmconvert and osmfilter to query extracts, or use Overpass API to request the live database. The Openstreetmap wiki will guide you through both.


http://wiki.openstreetmap.org/wiki/.poly#Converting_to.2Ffrom_POLY_format links several programmes which can convert to .poly format. I have not used them lately

  • I've checked them out, and have one question still: how is it possible to make .poly file from array of nodes? Should I really parse this XML and use some algorythm to join the coordinates?..
    – Alexander
    Feb 10 '14 at 5:52

Use osmosis (http://wiki.openstreetmap.org/wiki/Osmosis/Polygon_Filter_File_Format).

Osmosis can work with large files (for example, osmsharp can not). This is the best software, which I used, for this purposes:

For example, I extract some data from administrative boundaries. So I reduced the size of the database more than 30 times and increased the speed geocoding more than 15 times.

  • Osmosis can use POLY files, but cannot make them, isn't it? I'm currently checking out getbound.pl, it seems to do what I need
    – Alexander
    Feb 10 '14 at 11:55

The Geofabrik that offers OSM planet extracts also published the cutting polygones: http://download.geofabrik.de It can be usefull, if you are just looking for a smal number of boundaries.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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