iduedu.nearest_nodes

iduedu.nearest_nodes(urban_graph, gdf, *, graph_node_column='graph_node_id')[source]

Return the nearest graph node id for each input geometry.

Parameters:
  • urban_graph (UrbanGraph) – Graph whose nodes_gdf contains point geometries.

  • gdf (GeoDataFrame) – GeoDataFrame with geometries to match to graph nodes.

  • graph_node_column (str) – Name assigned to the returned Series.

Return type:

Series

Returns:

Series indexed like gdf with nearest node ids as values.

Raises:
  • TypeError – If gdf is not a GeoDataFrame.

  • ValueError – If graph or object geometries cannot be matched safely.