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((WKBFactory)self, (WayNodeList)list[, (use_nodes)use_nodes=osmium.geom.use_nodes.UNIQUE[, (direction)direction=osmium.geom.direction.FORWARD]]) → str :

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

create_linestring( (WKBFactory)self, (Way)way [, (use_nodes)use_nodes=osmium.geom.use_nodes.UNIQUE [, (direction)direction=osmium.geom.direction.FORWARD]]) -> str :
Create a LineString geometry from a osmium.osm.Way.
create_multipolygon((WKBFactory)self, (Area)area) → str :

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

create_point((WKBFactory)self, (Location)location) → str :

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

create_point( (WKBFactory)self, (Node)node) -> str :
Create a point geometry from a osmium.osm.Node.
create_point( (WKBFactory)self, (NodeRef)ref) -> 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((WKTFactory)self, (WayNodeList)list[, (use_nodes)use_nodes=osmium.geom.use_nodes.UNIQUE[, (direction)direction=osmium.geom.direction.FORWARD]]) → str :

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

create_linestring( (WKTFactory)self, (Way)way [, (use_nodes)use_nodes=osmium.geom.use_nodes.UNIQUE [, (direction)direction=osmium.geom.direction.FORWARD]]) -> str :
Create a LineString geometry from a osmium.osm.Way.
create_multipolygon((WKTFactory)self, (Area)area) → str :

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

create_point((WKTFactory)self, (Location)location) → str :

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

create_point( (WKTFactory)self, (Node)node) -> str :
Create a point geometry from a osmium.osm.Node.
create_point( (WKTFactory)self, (NodeRef)ref) -> 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((GeoJSONFactory)self, (WayNodeList)list[, (use_nodes)use_nodes=osmium.geom.use_nodes.UNIQUE[, (direction)direction=osmium.geom.direction.FORWARD]]) → str :

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

create_linestring( (GeoJSONFactory)self, (Way)way [, (use_nodes)use_nodes=osmium.geom.use_nodes.UNIQUE [, (direction)direction=osmium.geom.direction.FORWARD]]) -> str :
Create a LineString geometry from a osmium.osm.Way.
create_multipolygon((GeoJSONFactory)self, (Area)area) → str :

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

create_point((GeoJSONFactory)self, (Location)location) → str :

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

create_point( (GeoJSONFactory)self, (Node)node) -> str :
Create a point geometry from a osmium.osm.Node.
create_point( (GeoJSONFactory)self, (NodeRef)ref) -> 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((WayNodeList)list) → 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.