-
-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
While preparing #435 it seems that write_dataframe()
is happy to write a dataframe with (e.g.) a "POINT EMPTY" geometry. However, read_dataframe()
will read this geometry as None, so the two geodataframes don't round-trip. E.g.:
from pyogrio.geopandas import read_dataframe, write_dataframe
import geopandas as gp
from geopandas.array import from_wkt
expected = gp.GeoDataFrame({"x": [0]}, geometry=from_wkt(["POINT EMPTY"]), crs=4326)
print(expected)
# x geometry
# 0 0 POINT EMPTY
filename = "/tmp/test.shp"
write_dataframe(expected, filename)
df = read_dataframe(filename)
print(df)
# x geometry
# 0 0 None
Note this is the same as fiona, e.g.:
gp.read_file(filename, engine="fiona")
returns the same. And raw fiona doesn't do much better except identify the geometry type in the schema:
import fiona
with fiona.open(filename) as ds:
print(ds.meta["schema"])
print([(idx, feat.geometry) for idx, feat in ds.items()])
# {'properties': {'x': 'int:18'}, 'geometry': 'Point'}
# [(0, None)]
Metadata
Metadata
Assignees
Labels
No labels