I'm attempting to pull a set of building footprints from open street map using a shapefile boundary. I have success getting the buildings into a geodataframe, but when I attempt to write them out to a shapefile I get the following error:
ValueError: Invalid field type class 'list'
Here's my code
import osmnx as ox import shapefile import geopandas from shapely.geometry import shape shp = shapefile.Reader("StudyArea.shp") feature = shp.shapeRecords() first = feature.shape.__geo_interface__ #convert to shapely shape shp_geom = shape(first) fprints = ox.footprints.footprints_from_polygon(shp_geom, footprint_type ='building') ox.plot_shape(ox.project_gdf(fprints)) type(fprints) fprints.to_file('footprints.shp', driver='ESRI Shapefile')
Everything works except the last line when I attempt to write the file. It actually writes a shapefile but it writes an empty polyline shapefile (based on the icon in ArcCatalog) I've read about others who've had issues with the datatype conversion of some of the footprint attribute info but am new to geopandas and didn't find a clear solution.