cartagen.network_faces

Contents

cartagen.network_faces#

network_faces(*networks, convex_hull=True)#

Calculates the faces of one or multiple networks.

This function is often called polygonize. It creates polygons in place of a network of lines.

Parameters:
  • *networks (list of LineString) – The networks to generate the faces from. All the provided lists are merged into one list of geometries.

  • convex_hull (bool, optional) – If True, add the convex hull of the provided list of lines to the network, thus including the borders.

Returns:

list of Polygon

See also

partition_networks

Partition objects using one or multiple networks.

partition_quadtree

Partition objects using a quadtree.

Notes

When the network is not completely planar (e.g. tunnels and bridges inside a road network with crossing sections not intersecting), the network is fully unioned and merged.

Examples

>>> lines = [LineString([(0, 0), (1, 1), (2, 0), (3, 1)])]
>>> list(network_faces(lines))
[<POLYGON ((1 1, 3 1, 2 0, 1 1))>, <POLYGON ((2 0, 0 0, 1 1, 2 0))>]

(Source code)

../_images/network_faces.png