[postgis] distance(geometry,geometry) now in the CVS version
Dave Blasby
dblasby at refractions.net
Tue Jul 24 13:47:37 PDT 2001
The distance() function is now in the CVS version.
I've also put in expand(BOX3D,double d) which returns a new bbox which
is exanded d unit in all directions.
ie.
select expand('BOX3D(0 0 0, 100 100 100)', 100.0);
expand
-----------------------------------
BOX3D(-100 -100 -100,200 200 200)
(1 row)
also, because there's an auto-convesion between geometry and box3d, you
can;
select expand('POINT(0 0 0)'::GEOMETRY, 100.0);
expand
-----------------------------------
BOX3D(-100 -100 -100,100 100 100)
This will allow you to do an index search using distances more easily.
Lets say you take "A" as your base feature you're searching for nearby
objects;
select * from <table> where distance(A,<geom_col>) <100 and
<geom_col> && expand(A, 100) ;
<geom_col> && expand(A, 100):
this does an index scan on the table looking for features that might be
100 units or less away from A. It'll quickly filter out far away
features.
distance(A,<geom_col>) <100
this returns true if the min distance from A to the geometry is less
than 100 units
dave
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Small business owners...
Tell us what you think! http://promo2.yahoo.com/sbin/Yahoo!_BusinessNewsletter/survey.cgi
http://us.click.yahoo.com/vO1FAB/txzCAA/ySSFAA/PhFolB/TM
---------------------------------------------------------------------~->
To unsubscribe from this group, send an email to:
postgis-unsubscribe at yahoogroups.com
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the postgis-users
mailing list