io - Data In- and Output

This module exposes the generic file reader.

class osmium.io.Reader

A class that reads OSM data from a file.

close(self: osmium.io.Reader) None

Close any open file handles. The reader is unusable afterwards.

eof(self: osmium.io.Reader) bool

Check if the end of file has been reached.

header(self: osmium.io.Reader) osmium.io.Header

Return the header with file information, see osmium.io.Header.

class osmium.io.Header

File header with global information about the file.

add_box(self: osmium.io.Header, box: osmium.osm._osm.Box) osmium.io.Header

Add the given bounding box to the list of bounding boxes in the header.

box(self: osmium.io.Header) osmium.osm._osm.Box

Return the bounding box of the data in the file or an invalid box if the information is not available.

get(self: osmium.io.Header, key: str, default: str = '') str

Get the value of header option ‘key’ or default value if there is no header option with that name. The default cannot be None.

property has_multiple_object_versions

True if there may be more than one version of the same object in the file. This happens normally only in history files.

set(self: osmium.io.Header, key: str, value: str) None

Set the value of header option ‘key’.