Hi List;<br><br>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....<br><br>my_function(lon double precision, lat double precision, idlist character varying, bufferlist character varying)<br>
...<br><br><b>The query is;</b><br><br>query := 'select id ' ||<br>        'from companyvectors inner join (Select regexp_split_to_table('''||idlist||''', E''[,]+'') as a, regexp_split_to_table('''||bufferlist||''', E''[,]+'') as b) as x ' ||<br>
        'on <a href="http://companyvectors.id">companyvectors.id</a>=cast(x.a as bigint) ' ||<br>        'where '||        <br>        'st_dwithin(st_transform(companyvectors.polygon_geom,900913), st_transform(GeomFromText(''POINT('||lon||' '||lat||')'', 4326),900913), cast(x.b as double precision));';<br>
<br><b>What I need (it's faster) is a query something like (buffer is here cast(x.b as double precision)</b><b>);</b><br><br>polygon_geom && SetSRID('BOX2D(lat-buffer lon-buffer, lat+buffer lon+buffer)', 4326) <br>
<br>Need help.. Thanks in Advance...<br>