[postgis-users] Closest points to positions along a line
Thurber, Fred
Fred.Thurber at gdit.com
Wed Jul 29 06:14:42 PDT 2009
I am a newbie to PostGIS and have a spatial question.
We have a geographical straight line with equidistant positions along the line. We need to find the closest point for each position on the line.
I suppose that the obvious way to do this is to solve the closest point problem for each position on the line, but I cannot find an easy way to do this in PostGIS. I could "ORDER BY distance" and limit the results to 1. To prevent a full table search I suppose I could limit the search to an overlapping BOX2D (if there are no matches, I could use the expand function on the box until I find a match). Is there a better way to do this?
Is there a way to solve this problem in one step? I am tempted to draw a box around the whole line and return all the points in a subquery then do the distance queries on that result, but I am not sure I can do such a query in SQL.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20090729/a1515803/attachment.html>
More information about the postgis-users
mailing list