[postgis-users] ST_Contains - WGS84

William Temperley willtemperley at gmail.com
Fri Jun 27 10:13:10 PDT 2008

Martin Davis wrote:
> But, I think there is a bit of good news.  I'm pretty sure that if you
> are querying in lat-long space, relationships like ST_contains end up
> being *more inclusive*.  (I.e. you may get points returned which
> wouldn't actually lie in the geometry if it was densified).  This is due
> to the fact that the spheroid "blows up like a balloon" and curves lines
> outward.  This is probably better than the alternative of being *less
> inclusive*.

I disagree:
Take polygons A and B, completely disjoint but with a shared boundary.
Take point Z contained by polygon A in geodetic space.
We've said polygon B can be more inclusive in planar space and include point Z.
ST_contains will never say that A and B both contain point Z.
Point Z has therefore switched polygons.

> This also means that there is no problem using the standard PostGIS
> spatial index on geodetic data - the index is only an approximation
> anyway, so as long as it doesn't lose geometry (which it won't by the
> argument above) it will work fine.

I think because the edges of bounding boxes used by the index are
effectively meridians and parallels, the spatial indexes are a
different case, so we may be OK here?



More information about the postgis-users mailing list