GeoPandas to_file() saves GeoDataFrame without coordinate system
See original GitHub issueI have
GeoPandas 0.2.1 py27_0
fiona 1.7.0 np110py27_1
Python 2.7.10
installed in Anaconda 2-4.1.1-Windows-x86 environment. I am able to construct GeoDataFrame by reading input datasets and operate the data yet saving an output dataset does not preserve the coordinate system.
import geopandas as gpd
world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
world.to_file(driver='ESRI Shapefile',filename=r'C:\GIS\Temp\world_out.shp')
The world_out.shp does contain the features and the schema of the source shapefile, but coordinate system is undefined (<Unknown>). The world_out.prj file is 0 KB and doesn’t contain anything.
out = gpd.read_file(r'C:\GIS\Temp\world_out.shp')
print out.crs
>>> {}
I have tested to perform this operation using pure Fiona and it works fine, preserving the crs information.
So, it seems as GeoPandas is not able to write crs of the GeoDataFrame into the output dataset when calling the to_file() method. I have tried calling to_file() on GeoDataFrames constructed from various sources and datasets and the coordinate system information was never present in the output dataset.
What am I doing wrong or is it a bug?
Issue Analytics
- State:
- Created 7 years ago
- Comments:19 (11 by maintainers)

Top Related StackOverflow Question
Does is matter if your GDAL_DATA variable is set correctly, can you try:
and of course change the path to your settings.
Without this variable Fiona/Shapely doesn’t know how to create a proper .prj file based on a projection but rather saves an empty .prj file.
Since it seems as though a clean environment addresses this issue, will close this.