# pyosmium-up-to-date - Bringing OSM files up-to-date

## Usage

### pyosmium-up-to-date.py

Update an OSM file with changes from a OSM replication server.

Diffs are downloaded and kept in memory. To avoid running out of memory, the maximum size of diffs that can be downloaded at once is limited to 1 GB per default. This corresponds to approximately 3 days of update. The limit can be changed with the –size parameter. However, you should take into account that processing the files requires additional memory (about 1GB more).

The starting time is automatically determined from the data in the file. For PBF files, it is also possible to read and write the replication information from the osmosis headers. That means that after the first update, subsequent calls to pyosmium-up-to-date will continue the updates from the same server exactly where they have left of.

This program can update normal OSM data files as well as OSM history files. It detects automatically on what type of file it is called.

The program returns 0, if updates have been successfully applied up to the newest data or no new data was available. It returns 1, if some updates have been applied but there is still data available on the server (either because the size limit has been reached or there was a network error which could not be resolved). Any other error results in a return code larger than 1. The output file is guaranteed to be unmodified in that case.

Some OSM data sources require a cookie to be sent with the HTTP requests. Pyosmium-up-to-date does not fetch the cookie from these services for you. However, it can read cookies from a Netscape-style cookie jar file, send these cookies to the server and will save received cookies to the jar file.

    usage: pyosmium-up-to-date [options] <osm file>

<osm file>

  OSM file to update

-h, --help

  show this help message and exit

-v

  Increase verbosity (can be used multiple times)

-o <outfile>, --outfile <outfile>

  Name output of file. If missing, the input file will be overwritten.

--format <format>

  Format the data should be saved in.

--server <server_url>

  Base URL of the replication server. Default: ‘https://planet.osm.org/replication/hour/’ (hourly diffs from osm.org).

-s <size>, --size <size>

  Maximum size of change to apply at once in MB. Default: 1GB.

--tmpdir <tmpdir>

  Directory to use for temporary files. Default: directory of input file

--ignore-osmosis-headers

  Ignore potential replication information in the header of the input file and search for the newest OSM object in the file instead.

-b <wind_back>, --wind-back <wind_back>

  Number of minutes to start downloading before the newest addition to input data. (Ignored when the file contains a sequence ID.) Default: 60.

--force-update-of-old-planet

  Apply update even if the input data is really old.

--cookie <cookie>

  Netscape-style cookie jar file to read cookies from and where received cookies will be written to.

--socket-timeout <socket_timeout>

  Set timeout for file downloads.

--version

  show program’s version number and exit