[postgis-users] dwithin or && BBox

ibrahim saricicek ibrahimsaricicek at gmail.com
Wed Feb 16 06:49:41 PST 2011


Hi List;

I have four parameters lat, lon, idlist and bufferlist. In a function I can
find if point (lat lon) is in distance within the defined (in idlist)
objects....

my_function(lon double precision, lat double precision, idlist character
varying, bufferlist character varying)
...

*The query is;*

query := 'select id ' ||
        'from companyvectors inner join (Select
regexp_split_to_table('''||idlist||''', E''[,]+'') as a,
regexp_split_to_table('''||bufferlist||''', E''[,]+'') as b) as x ' ||
        'on companyvectors.id=cast(x.a as bigint) ' ||
        'where '||
        'st_dwithin(st_transform(companyvectors.polygon_geom,900913),
st_transform(GeomFromText(''POINT('||lon||' '||lat||')'', 4326),900913),
cast(x.b as double precision));';

*What I need (it's faster) is a query something like (buffer is here
cast(x.b as double precision)**);*

polygon_geom && SetSRID('BOX2D(lat-buffer lon-buffer, lat+buffer
lon+buffer)', 4326)

Need help.. Thanks in Advance...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110216/0ff18385/attachment.html>


More information about the postgis-users mailing list