Osmupdate
osmupdate downloads and cumulates OSM Changefiles of different categories (minutely, hourly, daily). This allows you to create new changefiles for every time period you need and to update your OSM data files in regular or irregular intervals, just as you like.
Note that this is not the only mechanism for automatic OSM data updates, you usually will want to use Osmosis for this purpose. osmupdate is a small, specialized program, it was developed just for this task. It might offer a few functions Osmosis doesn't have, but there also are a lot of functions you might miss in osmupdate.
- Please be careful, this program is very new and may have some bugs.
Contents |
Use Cases
- You want to keep your local PostgreSQL database up-to-date and minutely in sync with the servers of openstreetmap.org.
- Do not use osmupdate. Use Osmosis or osm2pgsql or any other tool instead. osmupdate cannot update databases.
- You need to update the OSM file of a small geographical region every other week.
- Do not use osmupdate. Redownload the file from one of the OSM file services, e.g. geofabrik.de.
- You just found an old OSM planet file from a year ago and want to update it.
- Do not use osmupdate. Redownload the whole planet file.
- You have an OSM data file of a larger geographical region and need to update it every few hours, every day, or every week.
- It is recommended to use osmupdate for this purpose.
Download
These Downloads are available:
- binary for Linux 32 bit
- binary for Windows 32 bit (on Vista or Win7 rename the file to e.g. osmup.exe after download, else Windows may assume the program is a setup file)
- source code (newest version)
- (previous source code)
- Download and build in one run: wget -O - http://m.m.i24.cc/osmupdate.c | cc -x c - -o osmupdate
As usual: There is no warranty, to the extent permitted by law.
Prerequisites
osmupdate will call subprograms which must be available on your system:
- osmconvert
- wget
- gzip (if you want to write gzip compressed files)
Please ensure that these programs have been downloaded and installed.
Program Description
This program cares about updating an .osm, .o5m or .pbf file. It will download and apply OSM Change files (.osc) from the servers of "planet.openstreetmap.org". It also can assemble a new .osc or .o5c file which can be used to update your OSM data file at a later time.
Two command line arguments are mandatory: the name of the old and the name of the new OSM data file. If the old data file does not have a file timestamp, you can specify this timestamp manually on the command line or the program itself analyzes it with the program osmconvert.
Instead of the second OSM file name, you alternatively may specify the name of a changefile (.osc or .o5c). In this case, you also may replace the name of the old OSM data file by a timestamp. Command line arguments which are not recognized by osmupdate will be passed to osmconvert. Use this opportunity to supply a bounding box or a bounding polygon if you are going to update a regional change file.
To get a detailed description, please use the built-in help function of the program:
./osmupdate --help
The following chapters demonstrate some usage examples.
Updating OSM Files
Out-of-date OSM data files can be updated and written as new files (.o5m, .o5m.gz, .osm, .osm.gz or .pbf). For safety reasons osmupdate will not delete the old file. If you do not need it as backup file, please delete it by yourself. Examples:
./osmupdate old_file.o5m new_file.o5m ./osmupdate old_file.o5m.gz new_file.o5m.gz ./osmupdate old_file.osm new_file.osm ./osmupdate old_file.osm.gz new_file.osm.gz ./osmupdate old_file.pbf new_file.pbf
If your old OSM data file does not contain a file timestamp, this timestamp can be specified manually
./osmupdate old_file.osm 2011-02-15T23:30:00Z new_file.osm
otherwise the program tries to extract the timestamp from the old file automatically.
Assembling an OSM Change file
Here, the old OSM data file is not updated directly. An OSM changefile is written instead. This changefile can be used to update the OSM data file afterwards. You also can use the changefile to update a database with Osmosis or osm2pgsql. Examples for assembling changefiles:
./osmupdate old_file.o5m change_file.o5c ./osmupdate old_file.osm change_file.osc ./osmupdate 2011-02-15T23:30:00Z change_file.o5c ./osmupdate 2011-02-15T23:30:00Z change_file.osc.gz
Applying Geographical Borders
In the following example, we want to update an OSM file which contains only European OSM data. Hence the downloaded OSM changefiles contain not only London, but the whole planet, a lot of unneeded data would be added to this regional file. The -B= argument will clip these superfluous data.
./osmupdate europe_old.o5m europe_new.o5m -B=europe.poly
You also may use -b= option of osmconvert to specify a bounding box. Please refer to osmconvert program description for further information.
It is not possible to use the --complete-ways option from osmconvert (used to retain all the nodes belonging to a way, even when they lie outside of the bounding box or polygon) when updating.
Limit Changefile Categories
If you need to update your OSM file only once a day or once a week, you may want to consider the limitation of changefile category to daily. This will prevent minutely and hourly changefiles from being downloaded and therefore save a lot of data traffic. Use this option:
--dailyFor updates every few hours, you usually would not need minutely changefiles. So please consider applying this option:
--hourly --daily
Keep Temporary Files
Another way to minimize data traffic is to keep local copies of every downloaded file. This is especially recommended if you are going assemble chronologically overlapping changefiles. The command line option:
--keep-tempfilesVerbose Output
osmupdate works very quietly. If you have suspicions that something might go wrong, or if you are just curious, then activate the verbose mode:
v
Data Source
Usually, osmupdate downloads the changefile data from http://planet.openstreetmap.org/. If you want to use a different source, for example the mirror server, Free OSM, or the data available during the license-change period, you may specify this by the --planet-url= option. Examples:
--planet-url=mirror --planet-url=http://planet.fosm.org/planet/ --planet-url=http://planet.openstreetmap.org/redaction-period/
Benchmarks
Please add your benchmark results.