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

Paul Ramsey pramsey at cleverelephant.ca
Mon Sep 8 13:39:08 PDT 2008


It gets better, since the bbox check often recurs in the GEOS code
base too. However, it's not exactly a high cost check, and there are
cases where there functions will be called sans indexes. Doing the
check in postgis potentially saves a trip to GEOS. The GEOS checks
have to be there to support pure-GEOS apps.

C'est la vie.

P.

On Mon, Sep 8, 2008 at 12:14 PM, Obe, Regina <robe.dnd at cityofboston.gov> wrote:
> 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.
>
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-devel
>
>



More information about the postgis-devel mailing list