[postgis-users] ST_Contains - WGS84

Obe, Regina robe.dnd at cityofboston.gov
Fri Jun 27 05:30:43 PDT 2008


I could be way off base here because I don't think too much about
geometries except in my little world so maybe someone can correct me if
my assumptions are way off base.

Topological relations and processes like ST_Contains, ST_Intersection,
ST_Intersects are operations that are always valid regardless of if your
data is projected or unprojected.

If a contains b in WGS 84 long lat space, a will contain b in any
projection  you can project them to (and vice versa).  I think about
these things as just wrapping rubber bands around stuff. No matter how
you distort the shape of the rubber band, things inside it are always
inside it.

Now as far as indexes go - they wouldn't be as efficient in
non-projected space because a box in unprojected has less meaning (since
its a planar thing in spherical space).  So your operation will work but
it will be slower since you'll get more false positives.  

An extent will always contain the geometry in question regardless of
projection (although the extent of unprojected would be different from
if you had it in planar).  Regardless - all objects contained within an
object should always have extents that intersect the extent of the
object that contains them in any space.  So my thought process tells me,
you shouldn't get any points left out, you'll just get more false
positives from the && operation and thus slower performance.

So just keep your data in SRID 4326  do your contains in that and see
how slow it is.  May not be all that slow.

Hope that helps,

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
William Temperley
Sent: Friday, June 27, 2008 4:49 AM
To: postgis-users at postgis.refractions.net
Subject: [postgis-users] ST_Contains - WGS84

Hi all

Is there currently an accurate way to run queries like ST_Contains on
geodetic data?

My dataset is global and I may have to perform queries on a
continental scale, e.g. find all the points in Africa.  I don't think
I can reproject to the UTM zone in question, given the queries will
span several zones.  Is there a projection I can use temporarily to
perform queries like this?

I'm also slightly worried that the planar nature of the spatial
indexes could prematurely remove points from the result set - is this
the case?

postgis-users mailing list
postgis-users at postgis.refractions.net
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.

More information about the postgis-users mailing list