Skip to content

Commit ef47f0d

Browse files
authored
TST: Fix write of FlatGeobuf for empty / null geometries for GDAL >= 3.6.4 (#247)
1 parent dc211d2 commit ef47f0d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pyogrio/tests/test_geopandas_io.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -946,6 +946,11 @@ def test_write_geometry_z_types_auto(
946946
gdf = gp.GeoDataFrame(column_data, geometry=from_wkt(wkt), crs="EPSG:4326")
947947
filename = tmp_path / f"test{ext}"
948948

949+
if ext == ".fgb":
950+
# writing empty / null geometries not allowed by FlatGeobuf for
951+
# GDAL >= 3.6.4 and were simply not written previously
952+
gdf = gdf.loc[~(gdf.geometry.isna() | gdf.geometry.is_empty)]
953+
949954
if mixed_dimensions and DRIVERS[ext] in DRIVERS_NO_MIXED_DIMENSIONS:
950955
with pytest.raises(
951956
DataSourceError,
@@ -962,10 +967,6 @@ def test_write_geometry_z_types_auto(
962967
result_gdf = read_dataframe(filename)
963968
if ext == ".geojsonl":
964969
result_gdf.crs = "EPSG:4326"
965-
if ext == ".fgb":
966-
# When the following gdal issue is released, this if needs to be removed:
967-
# https://github.com/OSGeo/gdal/issues/7401
968-
gdf = gdf.loc[~((gdf.geometry == np.array(None)) | gdf.geometry.is_empty)]
969970

970971
assert_geodataframe_equal(gdf, result_gdf)
971972

0 commit comments

Comments
 (0)