[postgis-users] Nearest line from a point

Jaime Casanova jaime at 2ndquadrant.com
Sat Aug 20 12:34:02 PDT 2011


On Sat, Aug 20, 2011 at 7:36 AM, Charles Galpin <cgalpin at lhsw.com> wrote:
> I assume you mean it takes a long time? The key is to create a buffer around the point that is as big as you feel necessary to make a
> match, and then in your where clause only match lines that intersect this. That way the index is used to limit the number of
> candidates to get the distance for.  Something like
>
> where line && st_expand(myPoint, bufferSizeInYourProjectionUnits)
>

st_dwithin() doesn't do this automatically?
but i should admit it wasn't useful for me... it still require a seq
scan on the whole table

-- 
Jaime Casanova         www.2ndQuadrant.com
Professional PostgreSQL: Soporte 24x7 y capacitación



More information about the postgis-users mailing list