momepy.get_node_id

momepy.get_node_id(objects, nodes, edges, node_id, edge_id, verbose=True)[source]

Snap each building to closest street network node on the closest network edge.

Adds node ID to objects (preferably buildings). Gets ID of edge (momepy.get_network_id()) , and determines which of its end points is closer to building centroid.

Parameters
objectsGeoDataFrame

GeoDataFrame containing objects to snap

nodesGeoDataFrame

GeoDataFrame containing street nodes with unique node ID. If there is none, it could be generated by momepy.unique_id().

edgesGeoDataFrame

GeoDataFrame containing street edges with unique edge ID and IDs of start and end points of each segment. Start and endpoints are default outcome of momepy.nx_to_gdf().

node_idstr, list, np.array, pd.Series (default None)

the name of the nodes dataframe column, np.array, or pd.Series with unique id

verbosebool (default True)

if True, shows progress bars in loops and indication of steps

Returns
node_idsSeries

Series containing node ID for objects