spaghetti.element_as_gdf

spaghetti.element_as_gdf(net, vertices=False, arcs=False, pp_name=None, snapped=False, id_col='id', geom_col='geometry')[source]

Return a geopandas.GeoDataFrame of network elements. This can be (a) the vertices of a network; (b) the arcs of a network; (c) both the vertices and arcs of the network; (d) raw point pattern associated with the network; or (e) snapped point pattern of (d).

Parameters
netspaghetti.Network

network object

verticesbool

Extract the network vertices. Default is False.

arcsbool

Extract the network arcs. Default is False.

pp_namestr

Name of the network PointPattern to extract. Default is None.

snappedbool

If extracting a network PointPattern, set to True for snapped point locations along the network. Default is False.

id_colstr

GeoDataFrame column name for IDs. Default is 'id'.

geom_colstr

GeoDataFrame column name for geometry. Default is 'geometry'.

Returns
pointsgeopandas.GeoDataFrame

Network point elements (either vertices or PointPattern points) as a geopandas.GeoDataFrame of shapely.Point objects with an id column and geometry column.

linesgeopandas.GeoDataFrame

Network arc elements as a geopandas.GeoDataFrame of shapely.LineString objects with an id column and geometry column.

Raises
KeyError

In order to extract a PointPattern it must already be a part of the spaghetti.Network object. This exception is raised when a PointPattern is being extracted that does not exist within the spaghetti.Network object.

Notes

This function requires geopandas.