[OSM-dev] Which is best for this task, osmosis, osmconvert osmupdate or...

Paul Norman penorman at mac.com
Wed Dec 30 04:55:04 UTC 2015



On 12/29/2015 4:02 PM, Dave F. wrote:
> Thanks for the reply.
>
>> Your best bet is to get an extract from Geofabrik which contains the 
>> areas you need and use their daily diffs to keep it up to date. If 
>> you need a smaller area, extract it from this larger file every day.
>
> A couple of problems with that, I'm afraid. Firstly they don't provide 
> my area

Not even the British Isles file covers the area you need?

> & secondly I'm trying to avoid large downloads like the 670mb England 
> file & amendment files for data I'm never going to need.

The diff files are 1-2 MB/day.

I suppose one option if the area you need crosses a couple of extracts 
and there's not a suitable one that covers both is to combine multiple 
extracts. You'd then consume the diffs for each extract and merge 
multiple files locally. Greater London is 50k-150k/day, and that's 
probably the biggest sub-region.

I can see doing this two ways

osmosis
   --rri workingDirectory=area1 --simc --rbf area1/current.pbf --ac 
--tee --wb area1/new.pbf
   --rri workingDirectory=area2 --simc --rbf area2/current.pbf --ac 
--tee --wb area2/new.pbf
   --merge # repeat --merge as many times as needed
   --bp --wb yourarea-new.pbf

Then swap files around to have the new files.

Another option would be

osmosis --rri workingDirectory=area1 --rri workingDirectory=area2 --mc # 
repeat --mc as needed
   --simc --rbf bigarea-current.pbf --ac --tee --wb bigarea-new.pbf --bp 
--wb myarea-new.pbf

I'm not sure which is better, and both might need some sorts and buffers.
>>> Is it better to work with a raw OSM data file or use a .pbf file? In 
>>> fact I'm a bit confused what one is. From the wiki it firstly says 
>>> "alternative to the XML format", but then goes on to compare it with 
>>> a compressed file format. Which is it?
>>
>> OSM PBFs are raw OSM data, as is OSM XML and o5m. They're just 
>> different file formats. Avoid OSM XML unless you're using software 
>> which only supports that. Use PBF or o5m instead. PBF is easier to 
>> use with the workflow I describe above since you can download a PBF 
>> directly from Geofabrik.
>
> So it's the original OSM(XML) fie format that's been compressed into a 
> PBF container, similar in concept to zip files?

No, it's OSM data in the standard OSM data model of nodes, ways, and 
relations, encoded in a particular way. There isn't XML in it anywhere. 
There's more detail about the format on the wiki, but as a user the 
three parts that matter are that it's smaller than bzipped XML, faster 
than bzipped XML or decompressed XML, and most tools support it.



More information about the dev mailing list