[OSM-newbies] How to merge two (or more) osm files into one largefile?
Brett Henderson
brett at bretth.com
Thu Aug 14 07:01:25 BST 2008
Jakub Klawiter wrote:
> Hello!
>
> On Fri, Aug 8, 2008 at 3:03 PM, Brett Henderson <brett at bretth.com> wrote:
>
>> It's possibly too late now, but the command line to merge two files
>> would look something like this:
>> osmosis --rx file2.osm --rx file1.osm --m --wx merged.osm
>>
> Thnx. So generally if there is something like: inPipe.0 inPipe.1
> inPipe.n i should change it to set of --rx file than what i want to do
> (-m) as a command which has one out pipe --wx?
>
> Is it the way how it is working? Strange, but i'll try to remember :)
>
>
I think the answer is yes, but I'm not sure if I understand your
question. I'll just give an example of how it works.
The --read-xml task produces a single output pipe identified by the
outPipe.0 argument.
The --merge task consumes two input pipes identified by the inPipe.0 and
inPipe.1 arguments, and produces a single output pipe identified by the
outPipe.0 argument.
The --write-xml task produces a single output pipe identified by the
outPipe.0 argument.
If inPipe/outPipe arguments are not supplied, pipes are pushed/pulled
to/from a default pipe stack.
This will merge file1.osm and file2.osm into merged.osm where file2 is
applied over the top of file1.
osmosis --read-xml file2.osm --read-xml file1.osm --merge --write-xml
merged.osm
The first --read-xml task (task1) will put a single pipe on the pipe
stack (pipe1).
The second --read-xml task (task2) will put a single pipe on pipe stack
(pipe2).
The --merge task (task3) consumes both pipes in stack order (pipe2, then
pipe1) and puts a single pipe on the pipe stack (pipe3).
The --write-xml task (task4) consumes the remaining pipe (pipe3) from
the stack.
If the stack behaviour is not appropriate or too confusing you can
explicitly name pipes in which case they will not be placed on the stack
and will have to be explicitly named in subsequent tasks to be
retrieved. This example is equivalent to the previous one but using
explicit pipes, it is completely untested, could be typos :-)
osmosis --read-xml file2.osm outPipe.0=mypipe2 --read-xml file1.osm
outPipe.0=mypipe1 --merge inPipe.0=mypipe1 inPipe.1=mypipe2
outPipe.0=mypipemerge --write-xml merged.osm inPipe.0=mypipemerge
Hope that helps ...
Brett
More information about the newbies
mailing list