[postgis-users] Intersection and contains

Martin Davis mbdavis at VividSolutions.com
Tue May 10 08:36:16 PDT 2005


As usual with any kind of floating-point arithmetic, round-off error can
cause computations to not be exact.  This applies to JTS/GEOS/PostGIS as
well, of course.   So unfortunately you can't always expect that overlay
operations obey the usual mathematical rules of boolean algebra.  

If you post the geometries I'd be interested in verifying that this is
indeed what's going on.

Martin Davis, Senior Technical Architect
Vivid Solutions Inc.      www.vividsolutions.com
Suite #1A-2328 Government Street Victoria, B.C. V8T 5G5
Phone: (250) 385 6040 - Local 308 Fax: (250) 385 6046


> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net 
> [mailto:postgis-users-bounces at postgis.refractions.net] On 
> Behalf Of Rod Taylor
> Sent: May 9, 2005 9:13 PM
> To: PostGis Mailing List
> Subject: [postgis-users] Intersection and contains
> 
> 
> I've been playing around with various regions, and noticed 
> that my Ontario and Toronto boundaries were a little 
> different (Toronto extended into the water). So I took the 
> intersection of them but the result of the intersection is 
> not contained within either of the original geoms. I find 
> this to be rather odd, but I really don't have any experience 
> with GIS.
> 
> Thanks!
> 
> 
> bric=# select contains(geomontario, intersection(geomontario,
> geomtoronto)) from tab;
>  contains
> ----------
>  f
> (1 row)
> 
> bric=# select area(intersection(geomontario, intersection(geomontario,
> geomtoronto))) from tab;
>         area
> --------------------
>  0.0686349223828984
> (1 row)
> 
> bric=# select area( intersection(geomontario,  geomtoronto)) from tab;
>         area
> --------------------
>  0.0686349223828984
> (1 row)
> 
> bric=# select intersects(geomontario, intersection(geomontario,
> geomtoronto)) from tab;
>  intersects
> ------------
>  t
> (1 row)
> 
> bric=# select issimple( intersection(geomontario,  
> geomtoronto)) from tab;  issimple
> ----------
>  t
> (1 row)
> 
> bric=# select isempty( intersection(geomontario,  
> geomtoronto)) from tab;  isempty
> ---------
>  f
> (1 row)
> 
> -- 
> 
> _______________________________________________
> postgis-users mailing list postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 



More information about the postgis-users mailing list