Skip to content

Geometry builders and functions🔗

osmium.geom.FactoryProtocol 🔗

Protocol for classes that implement the necessary functions for converting OSM objects into simple-feature-like geometries.

epsg: int property 🔗

Projection of the output geometries as a EPSG number.

proj_string: str property 🔗

Projection of the output geometries as a projection string.

create_linestring(line: LineStringLike, use_nodes: use_nodes = ..., direction: direction = ...) -> str 🔗

Create a line string geometry from a way like object. This may be a Way or a WayNodeList. Subsequent nodes with the exact same coordinates will be filtered out because many tools consider repeated coordinates in a line string invalid. Set use_nodes to osmium.geom.ALL to suppress this behaviour.

The line string usually follows the order of the node list. Set direction to osmium.geom.BACKWARDS to inverse the direction.

create_multipolygon(area: osmium.osm.Area) -> str 🔗

Create a multi-polygon geometry from an Area object.

create_point(location: PointLike) -> str 🔗

Create a point geometry from a Node, a location or a node reference.

osmium.geom.Coordinates 🔗

Represent a x/y coordinate. The projection of the coordinate is left to the interpretation of the caller.

x: float property 🔗

x portion of the coordinate.

y: float property 🔗

y portion of the coordinate.

valid() -> bool 🔗

Return true if the coordinate is valid. A coordinate can only be invalid when both x and y are NaN.

osmium.geom.GeoJSONFactory 🔗

Bases: osmium.geom.FactoryProtocol

Factory that creates GeoJSON geometries from osmium geometries.

osmium.geom.WKBFactory 🔗

Bases: osmium.geom.FactoryProtocol

Factory that creates WKB from osmium geometries.

osmium.geom.WKTFactory 🔗

Bases: osmium.geom.FactoryProtocol

Factory that creates WKT from osmium geometries.

osmium.geom.direction 🔗

osmium.geom.use_nodes 🔗

Geometry functions🔗

osmium.geom.lonlat_to_mercator(coordinate: Coordinates) -> Coordinates 🔗

Convert coordinates from WGS84 to Mercator projection.

osmium.geom.mercator_to_lonlat(coordinate: Coordinates) -> Coordinates 🔗

Convert coordinates from WGS84 to Mercator projection.