1
GeoPandas to_file()保存不带坐标系的GeoDataFrame
我有 GeoPandas 0.2.1 py27_0 菲奥娜1.7.0 np110py27_1 Python 2.7.10 安装在Anaconda 2-4.1.1-Windows-x86环境中。我能够GeoDataFrame通过读取输入数据集并进行操作来构造数据,但是保存输出数据集不会保留坐标系。 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') 在world_out.shp不包含的特征和源shape文件的模式,但坐标系是未定义的(<Unknown>)。该world_out.prj文件为0 KB,不包含任何内容。 out = gpd.read_file(r'C:\GIS\Temp\world_out.shp') print out.crs >>> {} 我已经测试过使用纯Fiona执行此操作,并且可以很好地保存crs信息: import fiona datasrc_path = r'C:\Program Files (x86)\ArcGIS\Desktop10.4\TemplateData\TemplateData.gdb' with fiona.drivers(): with fiona.open(datasrc_path,layer='cities') as source: meta = source.meta meta['driver'] = 'ESRI Shapefile' meta['layer'] …