[OSM-dev] Two scripts to make excerpts of planet.osm

Nick Burch openstreetmap at gagravarr.org
Wed Nov 1 23:11:32 GMT 2006

Hi All

Having found myself wanting to have just bits of planet.osm, without the 
faff of going via a database, I've written two more handy perl scripts.

First up, there's planetosm-excerpt-area.pl . This takes a bounding box, 
and only outputs the parts of the planet.osm that are within it (much like 
the -bbox parameter to planetosm-to-db.pl). So, you can produce a mini 
planet.osm for just one area, without going via a database.

Oh, and it reads from STDIN if you want it to, so you can do
 	bzcat planet-061023.osm.bz2 | planetosm-excerpt-area.pl -bbox  \
 		50,-2,60,1 | bzip > mini-planet.osm.bz2

Second, there's planetosm-excerpt-tags.pl . This finds ways with certain 
tags on them, their segments and nodes, and nodes with certain tags on 
them. So, you could do an area excerpt for just the UK, then filter it 
through this to get all the railways and cities, then pass that straight 
to osmarender.

It doesn't support STDIN, as it has to make multiple passes over the file, 
so you should probably do an area excerpt first.

Both can be found at http://svn.openstreetmap.org/utils/planet.osm/perl/


More information about the dev mailing list