momepy.get_node_id#
- momepy.get_node_id(objects, nodes, edges, node_id, edge_id=None, edge_keys=None, edge_values=None, verbose=True)[source]#
Snap each building to the closest street network node on the closest network edge. Adds node ID to objects (preferably buildings). Gets ID of edge (
momepy.get_network_id()
orget_network_ratio()
), and determines which of its end points is closer to the building centroid. Pass eitheredge_id
with a single value oredge_keys
andedge_values
with ratios.- Parameters:
- objectsGeoDataFrame
A GeoDataFrame containing objects to snap.
- nodesGeoDataFrame
A GeoDataFrame containing street nodes with unique node IDs. If there is none, it can be generated by
momepy.unique_id()
.- edgesGeoDataFrame
A GeoDataFrame containing street edges with unique edge IDs 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
The name of the
nodes
dataframe column,np.array
, orpd.Series
with a unique ID.- edge_idstr (default None)
The name of the objects dataframe column with unique edge IDs (like an outcome of
momepy.get_network_id()
).- edge_keysstr (default None)
The name of the objects dataframe column with
edgeID_keys
(like an outcome ofmomepy.get_network_ratio()
).- edge_valuesstr (default None)
The name of the objects dataframe column with
edgeID_values
(like an outcome ofmomepy.get_network_ratio()
).- verbosebool (default True)
If
True
, shows progress bars in loops and indication of steps.
- Returns:
- node_idsSeries
A Series containing node the ID for objects.