Loading...
Searching...
No Matches
osmium::io::Header Class Reference

`#include <header.hpp>`

## Public Member Functions

| Header ()=default
| Header (const std::initializer_list< osmium::Options::value_type > &values)
std::vector< osmium::Box > & | boxes () noexcept
const std::vector< osmium::Box > & | boxes () const noexcept
Header & | boxes (const std::vector< osmium::Box > &boxes) noexcept
osmium::Box | box () const
osmium::Box | joined_boxes () const
Header & | add_box (const osmium::Box &box)
bool | has_multiple_object_versions () const noexcept
Header & | set_has_multiple_object_versions (bool value) noexcept

## Private Attributes

std::vector< osmium::Box > | m_boxes
| Bounding boxes.
bool | m_has_multiple_object_versions = false

## Detailed Description

Meta information from the header of an OSM file.

The header can contain any number of bounding boxes, although usually there is only a single one (or none). PBF files only allow a single bounding box, but XML files can have multiple ones, although it is unusual and the semantics are unclear, so it is discouraged to create files with multiple bounding boxes.

The header contains a flag telling you whether this file can contain multiple versions of the same object. This is true for history files and for change files, but not for normal OSM data files. Not all OSM file formats can distinguish between those cases, so the flag might be wrong.

In addition the header can contain any number of key-value pairs with additional information. Most often this is used to set the "generator", the program that generated the file. Depending on the file format some of these key-value pairs are handled specially. See the Options parent class for details on how to set and get those key-value pairs.

## Constructor & Destructor Documentation

## Header() [1/2]

osmium::io::Header::Header | ( |  | ) |

default

## Header() [2/2]

osmium::io::Header::Header | ( | const std::initializer_list< osmium::Options::value_type > & | values | ) |

inline

## Member Function Documentation

## add_box()

Header & osmium::io::Header::add_box | ( | const osmium::Box & | box | ) |

inline

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

Returns
  The header itself to allow chaining.

## box()

osmium::Box osmium::io::Header::box | ( |  | ) | const

inline

Get the first (or only if there is only one) bounding box.

Returns an empty, invalid box if there is none.

## boxes() [1/3]

const std::vector< osmium::Box > & osmium::io::Header::boxes | ( |  | ) | const

inlinenoexcept

Get the bounding boxes defined in the header.

## boxes() [2/3]

std::vector< osmium::Box > & osmium::io::Header::boxes | ( |  | ) |

inlinenoexcept

Get the bounding boxes defined in the header.

## boxes() [3/3]

Header & osmium::io::Header::boxes | ( | const std::vector< osmium::Box > & | boxes | ) |

inlinenoexcept

Set all the bounding boxes in the header.

## has_multiple_object_versions()

bool osmium::io::Header::has_multiple_object_versions | ( |  | ) | const

inlinenoexcept

Can this file contain multiple versions of the same object?

## joined_boxes()

osmium::Box osmium::io::Header::joined_boxes | ( |  | ) | const

inline

Join up all the bounding boxes in the header into one and return it. This method is what you probably want to use unless you want to handle the possibly multiple bounding boxes yourself.

Returns an empty, invalid box if there is none.

## set_has_multiple_object_versions()

Header & osmium::io::Header::set_has_multiple_object_versions | ( | bool | value | ) |

inlinenoexcept

Set the flag that tells us whether this file can contain multiple versions of the same object?

Returns
  The header itself to allow chaining.

## Member Data Documentation

## m_boxes

std::vector<osmium::Box> osmium::io::Header::m_boxes

private

Bounding boxes.

## m_has_multiple_object_versions

bool osmium::io::Header::m_has_multiple_object_versions = false

private

Are there possibly multiple versions of the same object in this stream of objects? This should be true for history files and for change files, but not for normal OSM data files.

The documentation for this class was generated from the following file:

- include/osmium/io/header.hpp