[gdal-dev] Accurate -spat for ogr2ogr
Even Rouault
even.rouault at spatialys.com
Fri Oct 3 14:28:49 PDT 2014
Le vendredi 03 octobre 2014 23:11:31, Jukka Rahkonen a écrit :
> Hi,
>
> There are advanced options in ogr2ogr for clipping features to WKT or to a
> clipping layer. However, there does not seem to be a way to only select
> features without clipping them in a same way. A typical use case would be
> to select features from global dataset by country borders.
For that use case, I'm not sure if you would imagine selecting features that
intersect the specified shape (current semantics of -spat), or that are fully
contained within the shape ?
That can be done with sqlite dialect and use of a "SELECT ... FROM ... WHERE
ST_Intersects(geom_field, ST_GeomFromText('...'))" although I understand it is
less convenient than specifying a shapefile.
> Could this be
> doable and how? I have understood that -spat is doing a quick and not
> accurate selection by feature BBOXes
Normally, for well behaved drivers, -spat should do full intersection of the
spatial filter rectangle and the feature geometry when GEOS is available. It
does only intersection of the spatial filter rectangle and the feature BBOX
when GEOS isn't available
But it is true that the SetSpatialFilter() interface is mostly tested with
rectangle filters, so I wouldn't be completely surprised that some drivers
cheat and use only the geometry BBOX. Hum, seems to be the case of PostGIS.
Should be corrected.
> and "-spat [xmin ymin xmax
> ymax]|WKT|datasource" would not be good.
Why ?
> Perhaps it should be then
> something derived from "-clipsrc [xmin ymin xmax
> ymax]|WKT|datasource|spat_extent" like
>
> "-selectsrc [xmin ymin xmax ymax]|WKT|datasource"? And -selectdst could be
> supported in a similar way.
>
> -Jukka Rahkonen-
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
--
Spatialys - Geospatial professional services
http://www.spatialys.com
More information about the gdal-dev
mailing list