[Gdal-dev] Best way to test if one OGRLinearRing is inside of another?

Mateusz Loskot mateusz at loskot.net
Sun Sep 23 13:05:23 EDT 2007


Dan Homerick wrote:
> Hello List-Readers,
>
> I notice that the within/contains functions don't work for LinearRing's
> (as is indicated in the documentation for rings), but they also don't work
> with two LineStrings (not mentioned, that I see).

Dan,

You should know that spatial predicates are implemented using GEOS,
so you have to built GDAL/OGR with GEOS support in order to use them.

If this is not the case here and you already have GEOS support in OGR,
could you provide us with examples of geometries you're testing and
perhaps some code example?

> Is the best/only way to test if one ring is nested in another to convert
> the LinearRings to LineStrings, then test each point of 'inner' for
> containment in 'outer'?

Yes, I believe OGC predicates (within, contains, etc.) are the best tools
to solve this problem.

Cheers
-- 
Mateusz Loskot
http://mateusz.loskot.net



More information about the Gdal-dev mailing list