You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Encountering an "unhashable type" error Momepy.preprocess function #482
Both Momepy and GeoPandas are the most recent versions (see below). I also checked to make sure that I am passing a GeoDataFrame which returns <class 'geopandas.geodataframe.GeoDataFrame'>.
Steps to reproduce
importmomepyimportgeopandasasgpdimportosmnxasox#Get building geometries from OSMBN=ox.geometries_from_bbox(40.550055, 40.436808, -88.917847, -89.032860,
tags={'building':True})
#The data cannot be in a geographic coordinate system for momepy to run correctlyBN_projected=ox.projection.project_gdf(BN)
#Explode muti-part geometries into multiple single geometries.BN_exploded=BN_projected.explode()
#Strip out polygons from exploded gdfBN_exploded_poly=BN_exploded.loc[BN_exploded.geometry.type=='Polygon',:]
#Check to make sure all non-polygon geometries have been removedBN_exploded_poly.geometry#Reset index - this is a necessary step due to a bug in geopandasBN_exploded_poly=BN_exploded_poly.reset_index()
print(type(BN_exploded_poly))
#Run building data preprocessingBN_buildings=momepy.preprocess(BN_exploded_poly, size=30, compactness=0.2, islands=True)
Versions of your packages
momepy='0.5.4'
geopandas='0.12.2'
osmnx='1.2.2'
Your operating system
Windows 10 Enterprise, 64-bit
Additional context
I am returning to this code. It worked seamlessly 14 months ago and I have been unable to riddle out the errors I now encounter. Likely this is something wrong on my end, but over the past few days I've done all I can to solve the problem before reaching out here.
Activity
martinfleis commentedon Jun 5, 2023
We should deprecate
momepy.preprocessand extract its parts into individual functions...The error comes from code that is sub-optimal and shall be refactored on our side.
Anyway, I am not able to reproduce it, so no idea what is going on.