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

Brett Henderson brett at bretth.com
Mon Jul 21 01:29:34 BST 2008


Frederik Ramm wrote:
> Hi,
>
> 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.
>   
Yep, that is the best approach.  The polygon file can contain any number 
of polygon sections.  If you have individual polygon files, it should be 
relatively straightforward to merge them together using a simple text 
editor.
> 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.
>   
Yep, that will also work.  The command line will get fairly complicated, 
it will be easiest if you use explicit pipe names when connecting tasks 
together.

Brett





More information about the talk mailing list