[gdal-dev] setting a spatial filter on a postgis layer gives wrong results
jratike80
jukka.rahkonen at maanmittauslaitos.fi
Fri Jul 5 02:17:17 PDT 2019
Hi,
It should be already possible to make accurate filtering from PostGIS by
executing SQL with ST_Intersects.
-Jukka Rahkonen-
Even Rouault-2 wrote
> On vendredi 5 juillet 2019 10:12:41 CEST Landry Breuil wrote:
>> Hi,
>>
>> initially saw this with gdal 2.2.3 on debian, and confirmed the
>> behaviour is the same with gdal 3.0 on openbsd.
>>
>> I'm doing a spatial join between an union of geometries filtered from a
>> geopackage and a tileindex layer stored in postgis, and the spatial
>> filter set on the postgis layer behaves weird, the provided result is as
>> if the bbox of the spatial filter/geometry was used, instead of the
>> filter itself.
>
> This indeed exactly this. The PG driver implements spatial filtering only
> based on the envelope of the filter geometry, whereas the MEM driver uses
> the
> full geometry
>
> Quoting
> https://gdal.org/api/
> ogrlayer_cpp.html#_CPPv4N8OGRLayer16SetSpatialFilterEP11OGRGeometry
> """
> Currently this test is may be inaccurately implemented, but it is
> guaranteed
> that all features whose envelope (as returned by
> OGRGeometry::getEnvelope())
> overlaps the envelope of the spatial filter will be returned. This can
> result
> in more shapes being returned that should strictly be the case.
> """
>
> I guess the PG driver should be fixed. This is probably just an historical
> artifact.
>
> Even
>
> --
> Spatialys - Geospatial professional services
> http://www.spatialys.com
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at .osgeo
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html
More information about the gdal-dev
mailing list