[postgis] Re: Efficiency of a bounding box query vs distance()

thebanker95065 thebanker95065 at yahoo.com
Tue Feb 26 12:47:41 PST 2002


Dave,

Thanks for the info.  Do you know where I can find better information 
on the functions available to us?  In the PostGIS documentation, the 
function you use is not there.  Also, when I try to call the function 
it is not there.  I checked the source install, and I do have PostGIS 
0.6.2.  When I do postgis_version() I get:

xxxxxx=> select postgis_version();
 postgis_version 
-----------------
 0.6
(1 row)

And in trying to call the function:

xxxxxx=> select expand_box('POINT(25 25)'::geometry, 25);
ERROR:  Function 'expand_box(geometry, int4)' does not exist
        Unable to identify a function that satisfies the given 
argument types
        You may need to add explicit typecasts

Thanks for your help,

Grant
> 
> Its much more efficient to do a bounding box search because:
> 1. its really easy (just a few calculations)
> 2. the GiST index can be used.
> 
> If you really do want to do circle-distances for your application 
then
> you should do a:
> 
> select * from <table> where distance(the_geom,'POINT(x y)') <25 and
> the_geom && expand_bbox('POINT(x y)'::geometry,25)
> 
> This will do an index search to find everything thats within a box,
> centred at (x y), and has sides of length 2*25=50.
> This is done using the GiST index, so it will VERY quickly get a 
bunch
> of geometries that approximate your 
> circle-distance function.  The approximate results will then be 
checked
> by the expensive distance(...) function.
> 
> dave


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Tiny Wireless Camera under $80!
Order Now! FREE VCR Commander!
Click Here - Only 1 Day Left!
http://us.click.yahoo.com/nuyOHD/7.PDAA/yigFAA/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