momepy.get_nearest_street¶
-
momepy.get_nearest_street(buildings, streets, max_distance=
None)[source]¶ Identify the nearest street for each building.
- Parameters:¶
- buildings : GeoSeries | GeoDataFrame¶
GeoSeries or GeoDataFrame of buildings
- streets : GeoSeries | GeoDataFrame¶
GeoSeries or GeoDataFrame of streets
- max_distance : float | None, optional¶
Maximum distance within which to query for nearest street. Must be greater than 0. By default None, indicating no distance limit. Note that it is advised to set a limit to avoid long processing times.
Notes
In case of multiple streets within the same distance, only one is returned.
- Returns:¶
array containing the index of the nearest street for each building
- Return type:¶
np.ndarray
Examples
>>> path = momepy.datasets.get_path("bubenec") >>> buildings = geopandas.read_file(path, layer="buildings") >>> streets = geopandas.read_file(path, layer="streets")Get street index.
>>> momepy.get_nearest_street(buildings, streets) 0 0.0 1 33.0 2 10.0 3 8.0 4 8.0 ... 139 34.0 140 32.0 141 21.0 142 16.0 143 19.0 Length: 144, dtype: float64