I am trying to save a GeoDataFrame as a shapefile or spatialite, but for some reason, I get this error:
File "fiona\ogrext.pyx", line 951, in fiona.ogrext.WritingSession.start (fiona/ogrext.c:16479) AttributeError: 'int' object has no attribute 'encode'
My GeoDataFrame appears correctly without any issues, look's like there is something wrong with my gdf.to_file
command, but I have no idea what.
I checked if I have the most up-to-date libraries.
This is the code I use:
def writeIntoDatabase(input_path, numpy_point_array, 30):
print ('Reading data into shp')
df = pd.DataFrame(numpy_point_array)
dfthresh = df.loc[df[3] < 30]
geometry = [Point(xyz) for xyz in zip(dfthresh[0], dfthresh[1], dfthresh[2])]
#df = df.drop(['Lon', 'Lat', 'Alt'], axis=1)
print(geometry)
crs = {'init': 'epsg:27700'}
gdf = GeoDataFrame(dfthresh, crs=crs, geometry = geometry)
print (gdf)
gdf.to_file(driver = 'ESRI Shapefile', filename = input_path)
Can you help me?