diff --git a/autotest/ogr/ogr_vrt.py b/autotest/ogr/ogr_vrt.py index e5afc296eb04..43e8c612a548 100755 --- a/autotest/ogr/ogr_vrt.py +++ b/autotest/ogr/ogr_vrt.py @@ -3361,3 +3361,29 @@ def test_ogr_vrt_geom_coordinate_precision(): assert prec.GetXYResolution() == 1e-5 assert prec.GetZResolution() == 1e-3 assert prec.GetMResolution() == 1e-2 + + +############################################################################### +# Test OGRWarpedLayer and GetArrowStream + + +@pytest.mark.require_driver("GPKG") +def test_ogr_vrt_warped_arrow(tmp_vsimem): + + src_ds = ogr.Open( + """ + + + data/gpkg/2d_envelope.gpkg + + EPSG:32631 + + """ + ) + out_filename = str(tmp_vsimem / "out.gpkg") + with gdal.config_option("OGR2OGR_USE_ARROW_API", "YES"): + gdal.VectorTranslate(out_filename, src_ds) + ds = ogr.Open(out_filename) + assert ds.GetLayer(0).GetExtent() == pytest.approx( + (166021.443080541, 500000, 0.0, 331593.179548329) + ) diff --git a/ogr/ogrsf_frmts/generic/ogrwarpedlayer.cpp b/ogr/ogrsf_frmts/generic/ogrwarpedlayer.cpp index deec7d406399..c6acf0636188 100644 --- a/ogr/ogrsf_frmts/generic/ogrwarpedlayer.cpp +++ b/ogr/ogrsf_frmts/generic/ogrwarpedlayer.cpp @@ -543,6 +543,9 @@ int OGRWarpedLayer::TestCapability(const char *pszCapability) int bVal = m_poDecoratedLayer->TestCapability(pszCapability); + if (EQUAL(pszCapability, OLCFastGetArrowStream)) + return false; + if (EQUAL(pszCapability, OLCFastSpatialFilter) || EQUAL(pszCapability, OLCRandomWrite) || EQUAL(pszCapability, OLCSequentialWrite)) @@ -572,4 +575,14 @@ void OGRWarpedLayer::SetExtent(double dfXMin, double dfYMin, double dfXMax, sStaticEnvelope.MaxY = dfYMax; } +/************************************************************************/ +/* GetArrowStream() */ +/************************************************************************/ + +bool OGRWarpedLayer::GetArrowStream(struct ArrowArrayStream *out_stream, + CSLConstList papszOptions) +{ + return OGRLayer::GetArrowStream(out_stream, papszOptions); +} + #endif /* #ifndef DOXYGEN_SKIP */ diff --git a/ogr/ogrsf_frmts/generic/ogrwarpedlayer.h b/ogr/ogrsf_frmts/generic/ogrwarpedlayer.h index 97cc6c037e0e..4bf8deb87608 100644 --- a/ogr/ogrsf_frmts/generic/ogrwarpedlayer.h +++ b/ogr/ogrsf_frmts/generic/ogrwarpedlayer.h @@ -85,6 +85,9 @@ class CPL_DLL OGRWarpedLayer : public OGRLayerDecorator virtual OGRErr GetExtent(OGREnvelope *psExtent, int bForce = TRUE) override; virtual int TestCapability(const char *) override; + + virtual bool GetArrowStream(struct ArrowArrayStream *out_stream, + CSLConstList papszOptions = nullptr) override; }; #endif /* #ifndef DOXYGEN_SKIP */