[postgis-devel] ST_Contains / ST_Within

Paragon Corporation lr at pcorp.us
Fri Sep 26 16:15:00 PDT 2014


Fine by me.  I at first thought in my imagination that it was possible for a
box to not contain another box and for the geometries that have those boxes
to contain each other.  But after thinking some more I convinced myself it's
not possible in this world or any we would consider.
 
Regina

  _____  

From: postgis-devel-bounces at lists.osgeo.org
[mailto:postgis-devel-bounces at lists.osgeo.org] On Behalf Of Paul Ramsey
Sent: Friday, September 26, 2014 5:51 PM
To: PostGIS Development Discussion
Subject: [postgis-devel] ST_Contains / ST_Within


I was just working through strategy numbers and thinking about how we only
ever use RTOverlapStrategyNumber when I realized that we should be using
other strategies for at least a few of our functions, and yet we have 

CREATE OR REPLACE FUNCTION ST_Contains(geom1 geometry, geom2 geometry)
        RETURNS boolean
        AS 'SELECT $1 && $2 AND _ST_Contains($1,$2)'
        LANGUAGE 'sql' IMMUTABLE;

When really it should be

CREATE OR REPLACE FUNCTION ST_Contains(geom1 geometry, geom2 geometry)
        RETURNS boolean
        AS 'SELECT $1 ~ $2 AND _ST_Contains($1,$2)'
        LANGUAGE 'sql' IMMUTABLE;

Probably a small efficiency savings to be had in reducing the number of
geometries to be exact tested. Anyone see a reason we shouldn't do this? 

P.


-- 
Paul Ramsey
http://cleverelephant.ca 
http://postgis.net 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20140926/2b2e3e20/attachment.html>


More information about the postgis-devel mailing list