I have pandas dataframew ith two fields: ID and geometry (geometry is already in WKT). I want to change this dataframe into geodataframe so I can save it as shapefile.

I have tried to change it into geodataframe in the followong way:

covex = gdf(covex, crs="EPSG:4326", geometry='geometry')

that didn't work and I got this error message:

TypeError: 'GeoDataFrame' object is not callable

covex = gdf(covex, crs="EPSG:4326", geometry=covex.iloc[:,1])

but I got the same error messege.

What do I do wrong? I thought I should pass the geoemtry column there but seems like it should be somethng else. how can I change this into geodataframe and then to shapefile?


1 Answer 1


I think you are missing a function there(gdf.GeoDataFrame), I'm assuming you are importing geopandas as gdf.

here is a link to the documentation for creating GeoDataFrames, although I don't see anything about using a df to create, but I can't imagine it wouldn't work https://geopandas.org/reference/geopandas.GeoDataFrame.html https://geopandas.org/reference.html#geodataframe

import geopandas as gdf

# Thish should create a new dataframe
covex = gdf.GeoDataFrame(covex, crs="EPSG:4326", geometry=covex.iloc[:,1])

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.