GeoPandas to_file() saves GeoDataFrame without coordinate system

I have

  • GeoPandas 0.2.1 py27_0
  • fiona 1.7.0 np110py27_1
  • Python 2.7.10

installed in Anaconda 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:

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'] = source.name          with fiona.open(r'C:\GIS\CitiesFiona.shp', 'w', **meta) as sink:             for f in source:                 sink.write(f) 

The CitiesFiona.prj file does contain the information about the coordinate system.

So, it seems as GeoPandas is not able to read/write crs of the data frame 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.

Has anyone run into this issue before? Can anyone test this?

Replay

Category: python Time: 2016-07-31 Views: 6

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.164 (s). 12 q(s)