tomalrussell / snkit

spatial networks toolkit (python)
MIT License
31 stars 10 forks source link

Reproduce and fix error using nearest_edge with non-numeric or non-sequential index #49

Closed tomalrussell closed 10 months ago

tomalrussell commented 2 years ago

gdf.sindex.nearest is returning the index location (iloc) rather than the index (loc)

(as in https://geopandas.org/en/stable/docs/reference/api/geopandas.sindex.SpatialIndex.nearest.html)

it crashed during nearest_edge because my edges geodataframe had a non-numeric index. Now I know about it it's not an issue since I can just reset index. Though I could envisage people not catching it if they had a numeric non sequential index though!

Thanks @barneydobson for the note