[postgis-users] PostGIS Capabilities

Markus Schaber schabios at logi-track.com
Tue Feb 24 04:35:06 PST 2004


Hi, Paul,

On Thu, 19 Feb 2004 07:15:48 -0800
Paul Ramsey <pramsey at refractions.net> wrote:

> >  Can we obtain all the points within a certain radius of a specified
> > points?
> 
> SELECT * FROM MYTABLE WHERE 
> DISTANCE(POINTS,GEOMETRYFROMTEXT('POINT(..)',SRID)) > RADIUS

Hmm.

logigis=# explain select * from streets where distance('POINT(2.129996
41.399738)',geom) < 0.5;                                           
QUERY PLAN                                            
-----------------------------------------------------------------------
---------------------------- 
Seq Scan on streets  (cost=0.00..3269125.48 rows=9200744 width=763)
   Filter: (distance('SRID=-1;POINT(2.129996 41.399738)'::geometry,
geom) < 0.5::double precision)

(2 rows)

It seems that such distance operation queries still involve a sequential
scan over the whole table. So one better combines this query with an
bounding box that is &&'ed to the geometries to make use of the index.

The same Problem appears when searching the nearest Object, PostGIS
cannot make any use of spatial indices in this case, so one has to
interate with growing bounding boxes...

Markus

-- 
markus schaber | dipl. informatiker
logi-track ag | rennweg 14-16 | ch 8001 zürich
phone +41-43-888 62 52 | fax +41-43-888 62 53
mailto:schabios at logi-track.com | www.logi-track.com



More information about the postgis-users mailing list