[OSM-talk] multiple bounding-polygons in one file?

Frederik Ramm frederik at remote.org
Sun Jul 20 22:46:12 BST 2008


Olga Sacharow wrote:
> Hello! I just started working with osmosis and the first problem I have is that I can not find an option how to extract several polygons out of the planet.osm file into one single file. I need one osm file with the openstreetmap data from several adjoining European countries together. Can please somebody tell me if that is possible?

Option 1: Create ONE polygon that encompasses the full area you need. If 
you have existing polygon files, use poly2osm, then modify them in JOSM, 
then use osm2poly.

Option 2, which will be slower, and is completely untested by me but 
should work in theory: Cut out individual polygons then merge them like so:

osmosis --rx input.osm --tee 2 --bp file=1.poly --bp file=2.poly --m 
--wx output.osm

where 1.poly and 2.poly are your polygons. If you have more than 2 
polygons, you'll have to increase the number behind --tee, and you will 
have to specify the --m option one time less often than the number of 
files, e.g.

osmosis --rx input.osm --tee 4 --bp ... --bp ... --bp ... --bp ... --m 
--m --m --wx output.osm

But check with BrettH if unsure.


Frederik Ramm  ##  eMail frederik at remote.org  ##  N49°00'09" E008°23'33"

More information about the talk mailing list