Skip to content

Commit

Permalink
ogr_gpkg.py: test lyr.GetExtent3D() on a 2D layer, and with filters
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Dec 9, 2023
1 parent d9cf0c8 commit 3dd19ec
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions autotest/ogr/ogr_gpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,16 @@ def test_ogr_gpkg_9(gpkg_ds):
extent = lyr.GetExtent()
assert extent == (5.0, 10.0, 5.0, 10.0), "got bad extent"

extent = lyr.GetExtent3D()
assert extent == (
5.0,
10.0,
5.0,
10.0,
float("inf"),
float("-inf"),
), "got bad extent"

fcount = lyr.GetFeatureCount()
assert fcount == 10, "got bad featurecount"

Expand Down Expand Up @@ -9842,3 +9852,18 @@ def test_ogr_gpkg_extent3d_envelope_variants(file_name):
lyr = ds.GetLayerByName("foo")
ext3d = lyr.GetExtent3D()
assert ext3d == (0.0, 3.0, 0.0, 3.0, 0.0, 3.0)

lyr.SetAttributeFilter("1 = 1")
ext3d = lyr.GetExtent3D()
assert ext3d == (0.0, 3.0, 0.0, 3.0, 0.0, 3.0)

lyr.SetAttributeFilter("1 = 0")
ext3d = lyr.GetExtent3D()
assert ext3d == (
float("inf"),
float("-inf"),
float("inf"),
float("-inf"),
float("inf"),
float("-inf"),
)

0 comments on commit 3dd19ec

Please sign in to comment.