[gdal-dev] How does ogr2ogr -spat work?

Brett Walker brett.walker at geometryit.com
Wed Jan 2 21:21:52 PST 2013


Hi List,

I have a technical question regarding the workings of 'ogr2ogr -spat'

>From the description regarding this option is:

-spat xmin ymin xmax ymax:
spatial query extents. Only features whose geometry intersects the extents will be selected. The geometries will not be clipped unless -clipsrc is specified

This can be found at the following website: http://www.gdal.org/ogr2ogr.html This provides more information than the command line help.

My question is what does the sentence 'Only features whose geometry intersects the extents will be selected' actually mean? What type of intersection is implied?

I have a spatial data source which I will describe in a generalized fashion as a set of polygons and disjoint multi-polygons that are arranged like 4 concentric rings.  The rings themselves are not polygons or multi-polygons but rather groups of them compose each ring. Label the rings from 1 to 4; the inner smallest circle is 1; the largest outer ring is 4.
I want to extract from the spatial data source only those geometries that have some part of them within a rectangular extent (spat extent) that covers, in some part, rings 1, 2 and 3 but not ring 4. When I use org2org -spat with the required extent I am getting geometries from ring 4. These geometries are disjoin multi-polygons that exist, in parts, around the whole of ring 4 but no part of the actual geometries extend into the rectangular extent, only the minimal bounding box of the geometry which of course covers the whole of the rectangular extent.

Is the implied intersection related to the minimal bounding box of the geometries and the rectangular extent?

How would I use the various options to achieve what I need?

Sorry if the description is vague. I could have described the spatial data source too generally and therefore misconstrued the problem entirely. I could provide a picture of the spatial representation of the data source showing the problem if people find it beneficial.

Thanks in advance,
Brett

Brett Walker <brett.walker at geometryit.com<mailto:brett.walker at geometryit.com>>
Software Developer / Analyst
Geometry Pty Ltd

Telephone               03 6223 1999
Mobile                     0458 498 386
Fax                          03 6223 1988
Web                        www.geometryit.com<http://www.geometryit.com/>
Address                   31 Salamanca Square, Battery Point, TAS 7004, Australia

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20130103/6816f17e/attachment.html>


More information about the gdal-dev mailing list