cartagen.partition_networks#
- partition_networks(objects, *networks)#
Partition objects using one or multiple networks.
Create the faces from one or multiple networks and partition the provided objects into groups. Objects are grouped when their centroid intersects the same network face. This algorithm rely on a
STRtreeindexing solution.- Parameters:
objects (
GeoDataFrameofGeometry) – The objects to partition. Their centroids are used to assign them to a network face.*networks (
GeoDataFrameofLineString) – The networks used to partition the objects.
- Returns:
partition (
tuple) – A tuple containing two elements :A list of lists of index ordered by the network faces
A list of the geometry of the network faces
See also
network_facesCalculates the faces of one or multiple networks.
partition_gridPartition objects using a grid of a given shape.
Examples
>>> points = GeoDataFrame(geometry=[ Point(2, 1), Point(4, 1) ]) >>> network = GeoDataFrame(geometry=[ LineString([(0, 0), (3, 0), (3, 2), (6, 2)]) ]) >>> partition_networks(points, network) ([[1], [0]], [<POLYGON ((3 2, 6 2, 3 0, 3 2))>, <POLYGON ((3 2, 3 0, 0 0, 3 2))>])