[OSM-dev] Extracting polygons from planet.osm - take 2

Keith Sharp kms at passback.co.uk
Thu Mar 15 20:49:24 GMT 2007


Following on from last weeks discussion about extracting polygons from
the weekly planet.osm I've derived a new Perl script form Frederiks
original.  New Features are:

- Takes input from a text file defining a polygon or polygons as a
sequence of longitudes and latitudes.

- Can optionally reduce the number of points in a polygon to improve
performance, at the expense of accuracy.

- Can read the planet.osm from STDIN or a file.

- Can output to a specified file or to STDOUT.

You can download the script from:


and an example polygon file (GB and Ireland again):


I would appreciate it if people could try this out and let me know if it
works, and is accurate!  If people think this is valuable I would like
to create directory in SVN for both the script and a collection of
polygon files, I am happy to oversee this.  I would also like to create
a Wiki page describing the script usage and polygon files.



More information about the dev mailing list