gpd.to_file(): Z dimension not saved with ESRI driver
See original GitHub issueIssue
The Z dimension of geometries is not preserved when using gpd.to_file() using the ESRI driver.
Example
import geopandas as gpd
from shapely.geometry import Point
point = Point(0, 0, 500)
gdf = gpd.GeoDataFrame(geometry=[point])
print(gdf)
geometry
0 POINT Z (0 0 500)
gdf.to_file('./foo')
# Try to read file back
gdf2 = gpd.read_file('./foo')
print(gdf2)
FID geometry
0 0 POINT (0 0)
Expected Behavior
I’d expect the Z dimension to be included.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
geopandas.GeoDataFrame.to_file
The OGR format driver used to write the vector file. If not specified, it attempts to infer it from the file extension. If...
Read more >python - GeoPandas to_file() saves GeoDataFrame without ...
I am able to construct GeoDataFrame by reading input datasets and operate the data yet saving an output dataset does not preserve the...
Read more >ArcGIS (Desktop, Engine, Server)
NIM075668 - Cannot save stops to feature class when using 3D network dataset. NIM075690 - Import XML fails with "geometry cannot have Z...
Read more >Vector layers (geopandas) - shapely - Michael Dorman
A GeoSeries , which holds the geometries in a special “geometry” column. Zero or more Series , which represent the non-spatial attributes. Since ......
Read more >14.2. Creating Layers
Define the Geometry type. If not a geometryless layer, you can specify whether it should Include Z dimension and/or Include M values. Specify ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Although I don’t fully understand how it works, as here (https://github.com/Toblerity/Fiona/issues/465) is stated that ‘3D Point’ should now be an alias for ‘Point’
I suppose the error is in inferring the schema (https://github.com/geopandas/geopandas/blob/master/geopandas/io/file.py#L111), in that it needs special casing for 3D data.
If you manually specify the schema, it seems to work: