[postgis-users] Spatial Index Workings

Paragon Corporation lr at pcorp.us
Wed Jun 16 18:14:36 PDT 2010


Paul,
 
 >  Finally and just to clarify, you say that the Z check is not performed
in the ST_Within and ST_DWithin cases. Thus my result set only contains
points within the X  
>  and Y plane boundaries of the Box3D where some of them could be outside
in the Z plane!!! If this is correct can you suggest a solution in PostGIS
SQL terms or will  
 > postprocessing the results in a seperate manner be required? Will 3D
awaremess of situations like this be included in future PostGIS versions.
 
 >  Anyway thanks again,
 
 Regarding future versions.  I think the other Paul (Paul Ramsey) is working
on changing the index structure for PostGIS 2.0 to handle 3D geometries, so
that would help there since the bounding box && short-circuit would be z
aware.  The ST_DWithin there is probably hope there too since that is a
native PostGIS function.  ST_Within is a GEOS function and I think GEOS is a
long ways away from being more 3D aware, unless someone is willing to fund
that effort.
 
 I'll let Paul, Mat, or Strk or Olivier respond to the GEOS/PostGIS 3D
relationship support future since they are more familiar with that area.
 
Regarding a work around, I think you can use the ST_ZMin and ST_ZMax
functions and since you are doing pretty much bounding box checks, that
should be sufficient.
http://www.postgis.org/documentation/manual-1.5/ST_ZMax.html
 
So your query would look something like
 
SELECT * FROM table1 INNER JOIN (SELECT table2.the_geom FROM table2 WHERE id
= 356) AS t2
        ON ST_DWithin(table1.the_geom, t2.the_geom, 5) 
WHERE ST_ZMin(table1.the_geom) >= ST_Zmin(t2.the_geom)
    AND ST_ZMax(table1.the_geom) <= ST_ZMax(t2.the_geom);
 
Regina
 
http://www.postgis.us
 
 


 
  _____  

Hotmail: Trusted email with Microsoft's powerful SPAM protection. Sign up
now. <https://signup.live.com/signup.aspx?id=60969>  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20100616/197d361f/attachment.html>


More information about the postgis-users mailing list