Module Contents#

class RoutingEngine(geometry: str | shapely.GeometryCollection | shapely.Polygon | shapely.MultiPolygon | shapely.MultiPoint | list[tuple[float, float]], **kwargs: Any)[source]#

RoutingEngine to compute the shortest paths with navigation meshes.

compute_waypoints(frm: tuple[float, float], to: tuple[float, float]) list[tuple[float, float]][source]#

Computes shortest path between specified points.

  • geometry

    Data to create the geometry out of. Data may be supplied as:

    • list of 2d points describing the outer boundary, holes may be added with use of excluded_areas kw-argument

    • GeometryCollection consisting only out of Polygons, MultiPolygons and MultiPoints

    • MultiPolygon

    • Polygon

    • MultiPoint forming a “simple” polygon when points are interpreted as linear ring without repetition of the start/end point.

    • str with a valid Well Known Text. In this format the same WKT types as mentioned for the shapely types are supported: GEOMETRYCOLLETION, MULTIPOLYGON, POLYGON, MULTIPOINT. The same restrictions as mentioned for the shapely types apply.

  • frm (tuple[float, float]) – point from which to find the shortest path

  • to (tuple[float, float]) – point to which to find the shortest path

Keyword Arguments:

excluded_areas – describes exclusions from the walkable area. Only use this argument if geometry was provided as list[tuple[float, float]].


List of points (path) from ‘frm’ to ‘to’ including from and to.

Return type:

list[tuple[float, float]]

is_routable(p: tuple[float, float]) bool[source]#

Tests if the supplied point is inside the underlying geometry.


If the point is inside the geometry.


p (tuple[float, float]) –

Return type:


mesh() list[tuple[tuple[float, float], tuple[float, float], tuple[float, float]]][source]#

Access the navigation mesh geometry.

The navigation mesh is store as a collection of triangles in CCW order.


The triangles composing the navigation mesh. Each triangle is encoded as 3-tuple of points.

Return type:

list[tuple[tuple[float, float], tuple[float, float], tuple[float, float]]]

edges_for(vertex_id: int)[source]#

vertex_id (int) –