geom - Geometry Helper Functions

This module provides various helper functions for geometry handling. Note: remember to apply a location handler before in order to use these geometry utilities on node locations.

Geometry Factories

class osmium.geom.WKBFactory

Factory that creates WKB from osmium geometries.

create_linestring(*args, **kwargs)

Overloaded function.

  1. create_linestring(self: osmium.geom.WKBFactory, list: osmium.osm._osm.WayNodeList, use_nodes: osmium.geom.use_nodes = use_nodes.UNIQUE, direction: osmium.geom.direction = direction.FORWARD) -> str

Create a LineString geometry from a osmium.osm.WayNodeList.

  1. create_linestring(self: osmium.geom.WKBFactory, way: osmium.osm._osm.Way, use_nodes: osmium.geom.use_nodes = use_nodes.UNIQUE, direction: osmium.geom.direction = direction.FORWARD) -> str

Create a LineString geometry from a osmium.osm.Way.

create_multipolygon(self: osmium.geom.WKBFactory, area: osmium.osm._osm.Area) → str

Create a MultiPolygon geometry from a osmium.osm.Area.

create_point(*args, **kwargs)

Overloaded function.

  1. create_point(self: osmium.geom.WKBFactory, location: osmium.osm._osm.Location) -> str

Create a point geometry from a osmium.osm.Location.

  1. create_point(self: osmium.geom.WKBFactory, node: osmium.osm._osm.Node) -> str

Create a point geometry from a osmium.osm.Node.

  1. create_point(self: osmium.geom.WKBFactory, ref: osmium.osm._osm.NodeRef) -> str

Create a point geometry from a osmium.osm.NodeRef.

epsg

(read-only) EPSG number of the output geometry.

proj_string

(read-only) projection string of the output geometry.

class osmium.geom.WKTFactory

Factory that creates WKT from osmium geometries.

create_linestring(*args, **kwargs)

Overloaded function.

  1. create_linestring(self: osmium.geom.WKTFactory, list: osmium.osm._osm.WayNodeList, use_nodes: osmium.geom.use_nodes = use_nodes.UNIQUE, direction: osmium.geom.direction = direction.FORWARD) -> str

Create a LineString geometry from a osmium.osm.WayNodeList.

  1. create_linestring(self: osmium.geom.WKTFactory, way: osmium.osm._osm.Way, use_nodes: osmium.geom.use_nodes = use_nodes.UNIQUE, direction: osmium.geom.direction = direction.FORWARD) -> str

Create a LineString geometry from a osmium.osm.Way.

create_multipolygon(self: osmium.geom.WKTFactory, area: osmium.osm._osm.Area) → str

Create a MultiPolygon geometry from a osmium.osm.Area.

create_point(*args, **kwargs)

Overloaded function.

  1. create_point(self: osmium.geom.WKTFactory, location: osmium.osm._osm.Location) -> str

Create a point geometry from a osmium.osm.Location.

  1. create_point(self: osmium.geom.WKTFactory, node: osmium.osm._osm.Node) -> str

Create a point geometry from a osmium.osm.Node.

  1. create_point(self: osmium.geom.WKTFactory, ref: osmium.osm._osm.NodeRef) -> str

Create a point geometry from a osmium.osm.NodeRef.

epsg

(read-only) EPSG number of the output geometry.

proj_string

(read-only) projection string of the output geometry.

class osmium.geom.GeoJSONFactory

Factory that creates GeoJSON geometries from osmium geometries.

create_linestring(*args, **kwargs)

Overloaded function.

  1. create_linestring(self: osmium.geom.GeoJSONFactory, list: osmium.osm._osm.WayNodeList, use_nodes: osmium.geom.use_nodes = use_nodes.UNIQUE, direction: osmium.geom.direction = direction.FORWARD) -> str

Create a LineString geometry from a osmium.osm.WayNodeList.

  1. create_linestring(self: osmium.geom.GeoJSONFactory, way: osmium.osm._osm.Way, use_nodes: osmium.geom.use_nodes = use_nodes.UNIQUE, direction: osmium.geom.direction = direction.FORWARD) -> str

Create a LineString geometry from a osmium.osm.Way.

create_multipolygon(self: osmium.geom.GeoJSONFactory, area: osmium.osm._osm.Area) → str

Create a MultiPolygon geometry from a osmium.osm.Area.

create_point(*args, **kwargs)

Overloaded function.

  1. create_point(self: osmium.geom.GeoJSONFactory, location: osmium.osm._osm.Location) -> str

Create a point geometry from a osmium.osm.Location.

  1. create_point(self: osmium.geom.GeoJSONFactory, node: osmium.osm._osm.Node) -> str

Create a point geometry from a osmium.osm.Node.

  1. create_point(self: osmium.geom.GeoJSONFactory, ref: osmium.osm._osm.NodeRef) -> str

Create a point geometry from a osmium.osm.NodeRef.

epsg

(read-only) EPSG number of the output geometry.

proj_string

(read-only) projection string of the output geometry.

Other Functions

osmium.geom.haversine_distance(list: osmium.osm._osm.WayNodeList) → float

Compute the distance using the Haversine algorithm which takes the curvature of earth into account. If a WayNodeList is given as a parameter the total length of the way in meters is computed.