<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from rtf -->
<style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<font face="Arial, sans-serif" size="2">
<div>I am a newbie to PostGIS and have a spatial question.</div>
<div><font face="Times New Roman, serif" size="3"> </font></div>
<div>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.</div>
<div><font face="Times New Roman, serif" size="3"> </font></div>
<div>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?</div>
<div><font face="Courier New, monospace"> </font></div>
<div>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.</div>
<div><font face="Courier New, monospace"> </font></div>
<div><font face="Courier New, monospace"> </font></div>
</font>
</body>
</html>