0

I am trying to export a GeoPandas Dataframe looking like this to an external file:

id   geometry
0    POLYGON ((39.92713 1.41394, 39.92703 1.41394, ...
1    POLYGON ((39.95126 1.41866, 39.95116 1.41867, ...
2    POLYGON ((39.94181 1.42505, 39.94171 1.42506, ...
3    POLYGON ((39.95875 1.43338, 39.95866 1.43339, ...
4    POLYGON ((39.96375 1.44061, 39.96366 1.44061, ...
..                                                 ...
105  POLYGON ((39.89128 1.57005, 39.89118 1.57005, ...
106  POLYGON ((39.84598 1.56894, 39.84588 1.56894, ...
107  POLYGON ((39.74900 1.56838, 39.74891 1.56839, ...
108  POLYGON ((39.78401 1.57033, 39.78392 1.57034, ...
109  POLYGON ((39.85403 1.56422, 39.85393 1.56422, ...

In fact, when I run the following, I get a file with empty geometry.

gdf.to_file('file.shp', driver="ESRI Shapefile")

Any tentative solution?

  • How did you install geopandas? This should normally work, there will likely be an issue on your machine. – martinfleis Jan 20 at 15:54
  • 1
    Does your geodataframe have the geometry column set as the "geometry" column? gdf.area should return non-zeros. Or, is your CRS set? gdf.crs should be non-None. – Ryan Jan 21 at 16:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.