This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Create change file in geographical boundaries with osmupdate

1

Hey,

is it possible to create a change file in geographical boundaries with osmupdate.

I already tried:

osmupdate germany-latest.osm.pbf 2014-11-23T21:22:02Z change_file.osc.gz -B=germany.poly

But the Change File always contains the entire globe.

regards

lakul

asked 25 Nov '14, 11:40

lakul83's gravatar image

lakul83
26225
accept rate: 0%

edited 25 Nov '14, 11:55


One Answer:

0

Yes it is possible, but it is a bit more complicated.

First you update your extract with osmupdate:

osmupdate germany-latest.osm.pbf germany-updated.osm.pbf -B=germany.poly

Then you calculate the differences with osmconvert:

osmconvert germany-updated.osm.pbf germany-latest.osm.pbf --diff --fake-lonlat --emulate-osmosis -o=diff.osc

This gies you the desired osm change file. After that you probably want to rename germany-updated.osm.pbf to germany-latest.osm.pbf to be able to run the same process again to get the next diff.

It has a slight problem though: you might get incomplete extracts when ways or relations move inside your boundary. This is why I do a slightly more complicated variant for the swiss extract on planet.osm.ch:

use a larger bbox around swizerland:

BBOX="5,45.3,11.3,48.3"

update this bbox:

osmupdate chbbox_updated.o5m chbbox.o5m --minutely -b=$BBOX

cut out switzerland from this larger region:

osmconvert chbbox_updated.o5m -B=$CHPOLY -o=switzerland_updated.o5m

and create the diff between the old cut out and the new one:

osmconvert switzerland_updated.o5m switzerland.o5m --diff --fake-lonlat --emulate-osmosis -o=diff.osc

answered 25 Nov '14, 13:01

datendelphin's gravatar image

datendelphin
23446
accept rate: 14%

Hi,

many thanks. This idea I had. The update of the file germany-latest.pbf but takes too long. I would like to update my tile server every 5 minutes.

Greetings Lakul

(25 Nov '14, 14:01) lakul83

This is ambitious. If your server is too slow, you will have to rely on other resources or tools. For example overpass offers augmented diffs: https://wiki.openstreetmap.org/wiki/Overpass_API/Augmented_Diffs But it only support BBOX for extracting a region. Or let someone with a fast server provide you with the regional diffs.

(25 Nov '14, 19:29) datendelphin

Source code available on GitHub .