Libosmium: osmium::geom Namespace Reference

Libosmium Fast and flexible C++ library for working with OpenStreetMap data

Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
osmium::geom Namespace Reference

Everything related to geometry handling. More...

## Namespaces
namespace | haversine
| Functions to calculate arc distance on Earth using the haversine formula.

## Classes
struct | Coordinates
class | GeometryFactory
class | IdentityProjection
class | MercatorProjection
struct | Tile

## Typedefs
template<typename TProjection = IdentityProjection>
using | GeoJSONFactory = GeometryFactory<osmium::geom::detail::GeoJSONFactoryImpl, TProjection>
template<typename TProjection = IdentityProjection>
using | OGRFactory = GeometryFactory<osmium::geom::detail::OGRFactoryImpl, TProjection>
template<typename TWriter, typename TProjection = IdentityProjection>
using | RapidGeoJSONFactory = GeometryFactory<detail::RapidGeoJSONFactoryImpl<TWriter>, TProjection>
template<typename TProjection = IdentityProjection>
using | WKBFactory = GeometryFactory<osmium::geom::detail::WKBFactoryImpl, TProjection>
template<typename TProjection = IdentityProjection>
using | WKTFactory = GeometryFactory<osmium::geom::detail::WKTFactoryImpl, TProjection>

## Enumerations
enum class | use_nodes : bool { unique = true , all = false }
enum class | direction : bool { backward = true , forward = false }
enum class | wkb_type : bool { wkb = false , ewkb = true }
enum class | out_type : bool { binary = false , hex = true }
enum class | wkt_type : bool { wkt = false , ewkt = true }

## Functions
bool | operator== (const Coordinates &lhs, const Coordinates &rhs) noexcept
bool | operator!= (const Coordinates &lhs, const Coordinates &rhs) noexcept
template<typename TChar, typename TTraits>
std::basic_ostream< TChar, TTraits > & | operator<< (std::basic_ostream< TChar, TTraits > &out, const Coordinates &c)
Coordinates | lonlat_to_mercator (const Coordinates &c)
Coordinates | mercator_to_lonlat (const Coordinates &c)
bool | contains (const osmium::Box &lhs, const osmium::Box &rhs) noexcept
bool | overlaps (const osmium::Box &lhs, const osmium::Box &rhs) noexcept
constexpr uint32_t | num_tiles_in_zoom (uint32_t zoom) noexcept
constexpr double | tile_extent_in_zoom (uint32_t zoom) noexcept
constexpr uint32_t | mercx_to_tilex (uint32_t zoom, double x) noexcept
constexpr uint32_t | mercy_to_tiley (uint32_t zoom, double y) noexcept
bool | operator== (const Tile &lhs, const Tile &rhs) noexcept
| Tiles are equal if all their attributes are equal.
bool | operator!= (const Tile &lhs, const Tile &rhs) noexcept
bool | operator< (const Tile &lhs, const Tile &rhs) noexcept
constexpr double | deg_to_rad (double degree) noexcept
| Convert angle from degrees to radians.
constexpr double | rad_to_deg (double radians) noexcept
| Convert angle from radians to degrees.

## Variables
constexpr double | MERCATOR_MAX_LAT = 85.0511288
constexpr double | PI = 3.14159265358979323846

## Detailed Description

Everything related to geometry handling.

## Typedef Documentation

## ◆ GeoJSONFactory

template<typename TProjection = IdentityProjection>

using osmium::geom::GeoJSONFactory = GeometryFactory<osmium::geom::detail::GeoJSONFactoryImpl, TProjection>

## ◆ OGRFactory

template<typename TProjection = IdentityProjection>

using osmium::geom::OGRFactory = GeometryFactory<osmium::geom::detail::OGRFactoryImpl, TProjection>

## ◆ RapidGeoJSONFactory

template<typename TWriter, typename TProjection = IdentityProjection>

using osmium::geom::RapidGeoJSONFactory = GeometryFactory<detail::RapidGeoJSONFactoryImpl<TWriter>, TProjection>

## ◆ WKBFactory

template<typename TProjection = IdentityProjection>

using osmium::geom::WKBFactory = GeometryFactory<osmium::geom::detail::WKBFactoryImpl, TProjection>

## ◆ WKTFactory

template<typename TProjection = IdentityProjection>

using osmium::geom::WKTFactory = GeometryFactory<osmium::geom::detail::WKTFactoryImpl, TProjection>

## Enumeration Type Documentation

## ◆ direction

enum class osmium::geom::direction : bool
| strong

Which direction the linestring created from a way should have.

Enumerator
backward | Linestring has reverse direction.
forward | Linestring has same direction as way.

## ◆ out_type

enum class osmium::geom::out_type : bool
| strong

Enumerator
binary |
hex |

## ◆ use_nodes

enum class osmium::geom::use_nodes : bool
| strong

Which nodes of a way to use for a linestring.

Enumerator
unique | Remove consecutive nodes with same location.
all | Use all nodes.

## ◆ wkb_type

enum class osmium::geom::wkb_type : bool
| strong

Enumerator
wkb |
ewkb |

## ◆ wkt_type

enum class osmium::geom::wkt_type : bool
| strong

Enumerator
wkt |
ewkt |

## Function Documentation

## ◆ contains()

bool osmium::geom::contains | ( | const osmium::Box & | lhs,
|  | const osmium::Box & | rhs )
| inlinenoexcept

Check whether one geometry contains another.

## ◆ deg_to_rad()

double osmium::geom::deg_to_rad | ( | double | degree | ) |
| constexprnoexcept

Convert angle from degrees to radians.

## ◆ lonlat_to_mercator()

Coordinates osmium::geom::lonlat_to_mercator | ( | const Coordinates & | c | ) |
| inline

Convert the coordinates from WGS84 lon/lat to web mercator.

Precondition
  c.valid()
  Coordinates must be in valid range, longitude between -180 and +180 degree, latitude between -MERCATOR_MAX_LAT and MERCATOR_MAX_LAT.

## ◆ mercator_to_lonlat()

Coordinates osmium::geom::mercator_to_lonlat | ( | const Coordinates & | c | ) |
| inline

Convert the coordinates from web mercator to WGS84 lon/lat.

Precondition
  c.valid()
  Coordinates must be in valid range (longitude and latidude between -/+20037508.34).

## ◆ mercx_to_tilex()

uint32_t osmium::geom::mercx_to_tilex | ( | uint32_t | zoom,
|  | double | x )
| constexprnoexcept

Get the tile x number from an x coordinate in web mercator projection in the given zoom level. Tiles are numbered from left to right.

## ◆ mercy_to_tiley()

uint32_t osmium::geom::mercy_to_tiley | ( | uint32_t | zoom,
|  | double | y )
| constexprnoexcept

Get the tile y number from an y coordinate in web mercator projection in the given zoom level. Tiles are numbered from top to bottom.

## ◆ num_tiles_in_zoom()

uint32_t osmium::geom::num_tiles_in_zoom | ( | uint32_t | zoom | ) |
| constexprnoexcept

Returns the number of tiles (in each direction) for the given zoom level.

## ◆ operator!=() [1/2]

bool osmium::geom::operator!= | ( | const Coordinates & | lhs,
|  | const Coordinates & | rhs )
| inlinenoexcept

## ◆ operator!=() [2/2]

bool osmium::geom::operator!= | ( | const Tile & | lhs,
|  | const Tile & | rhs )
| inlinenoexcept

## ◆ operator<()

bool osmium::geom::operator< | ( | const Tile & | lhs,
|  | const Tile & | rhs )
| inlinenoexcept

This defines an arbitrary order on tiles for use in std::map etc.

## ◆ operator<<()

template<typename TChar, typename TTraits>

std::basic_ostream< TChar, TTraits > & osmium::geom::operator<< | ( | std::basic_ostream< TChar, TTraits > & | out,
|  | const Coordinates & | c )
| inline

## ◆ operator==() [1/2]

bool osmium::geom::operator== | ( | const Coordinates & | lhs,
|  | const Coordinates & | rhs )
| inlinenoexcept

Check whether two Coordinates are equal. Invalid coordinates are equal to other invalid coordinates but not equal to any valid coordinates.

Because this is comparing floating point values, it might not give the right result if the coordinates have been the result of some calculation that introduced rounding errors.

## ◆ operator==() [2/2]

bool osmium::geom::operator== | ( | const Tile & | lhs,
|  | const Tile & | rhs )
| inlinenoexcept

Tiles are equal if all their attributes are equal.

## ◆ overlaps()

bool osmium::geom::overlaps | ( | const osmium::Box & | lhs,
|  | const osmium::Box & | rhs )
| inlinenoexcept

Check whether one geometry overlaps another.

## ◆ rad_to_deg()

double osmium::geom::rad_to_deg | ( | double | radians | ) |
| constexprnoexcept

Convert angle from radians to degrees.

## ◆ tile_extent_in_zoom()

double osmium::geom::tile_extent_in_zoom | ( | uint32_t | zoom | ) |
| constexprnoexcept

Returns the width or height of a tile in web mercator coordinates for the given zoom level.

## Variable Documentation

## ◆ MERCATOR_MAX_LAT

double osmium::geom::MERCATOR_MAX_LAT = 85.0511288
| constexpr

The maximum latitude that can be projected with the Web Mercator (EPSG:3857) projection.

## ◆ PI

double osmium::geom::PI = 3.14159265358979323846
| constexpr