[postgis-devel] What's the point of this exercise in intersects?

Obe, Regina robe.dnd at cityofboston.gov
Mon Sep 8 12:36:23 PDT 2008


Also noticed we have this same exercise repeated for touches, crosses, covers, within, disjoint.  I guess pretty much any function where we would normally do an && in PostgreSQL before it hits these functions.
 
The only place it doesn't seem redundant is in disjoint, but then again why don't we have disjoint using && in PostgreSQL.
 
wouldn't we just restate ST_Disjoint to use indexes by doing the below
 

 SELECT  NOT ($1 && $2)  OR _st_disjoint($1, $2) 
 
Thanks,
Regina
 
 
 
 
 

 
________________________________

From: postgis-devel-bounces at postgis.refractions.net on behalf of Obe, Regina
Sent: Mon 9/8/2008 3:14 PM
To: postgis-devel at postgis.refractions.net
Subject: [postgis-devel] What's the point of this exercise in intersects?


I was looking at the lwgeom_geos_c.c intersects function - starting at line 2039 and was thinking isnt' this
a bit redundant.  By the time we get into this function we have already done a bounding box check.  It probably isn't adding much overhead, but thought I would flag it as potentially redundant.
 
 /*
  * short-circuit 1: if geom2 bounding box does not overlap
  * geom1 bounding box we can prematurely return FALSE.
  * Do the test IFF BOUNDING BOX AVAILABLE.
  */
 if ( getbox2d_p(SERIALIZED_FORM(geom1), &box1) &&
  getbox2d_p(SERIALIZED_FORM(geom2), &box2) )
 {
  if ( box2.xmax < box1.xmin ) PG_RETURN_BOOL(FALSE);
  if ( box2.xmin > box1.xmax ) PG_RETURN_BOOL(FALSE);
  if ( box2.ymax < box1.ymin ) PG_RETURN_BOOL(FALSE);
  if ( box2.ymin > box2.ymax ) PG_RETURN_BOOL(FALSE);
 }
 
 
thanks,
Regina
 

________________________________

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. 

________________________________

Help make the earth a greener place. If at all possible resist printing this email and join us in saving paper. 



-----------------------------------------
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20080908/76f626b5/attachment.html>


More information about the postgis-devel mailing list