<div dir="ltr"><div>Just an update.<br>We've implemented a new method in MapWinGIS that is using GEOSNearestPoints and it is doing exactly what I was looking for.<br><br></div>Thanks,<br></div><div class="gmail_extra">

<br clear="all"><div><div dir="ltr"><br>
<br>
Paul<br>
<br>
<div style="font-size:13.3px;font-family:Verdana,Arial,Helvetica,sans-serif"><div style="border:1px solid #e5e5e5;background-color:#f8f8f8;padding:0.8em 0.8em 0.3em 0.8em"><div style="margin:0 0 8px 0"><p style="margin:0">

<span><b><img style="float:left;margin-left:5px;margin-right:5px" src="http://www.bontepaarden.nl/bontepaarden/images/newButton.png" alt="" height="120" width="160">Paul Meems </b><br><span>Release manager, configuration manager</span><br>

<span>and forum moderator of MapWindow GIS.</span><br><a href="http://www.mapwindow.org/" target="_blank"><span>www.mapwindow.org</span></a><br><br><span>Owner of MapWindow.nl - Support for</span><br><span>Dutch speaking users.</span><br>

<a href="http://www.mapwindow.nl/" target="_blank"><span>www.mapwindow.nl</span></a><br></span></p>
<p style="margin:0px"><b><br></b></p><p style="margin:0px"><b>Join us at the <a href="http://geogis.detek.unideb.hu/TKonferencia/2014/" target="_blank">MapWindow GIS Conference 2014</a>, in Debrecen Hungary<br></b></p></div>

</div><img src="http://p1.wisestamp.com/pixel.png?p=mozilla&v=3.9.12&t=1322134056890&u=482737fd0c4ca423" height="1" width="1"></div>
</div></div>
<br><br><div class="gmail_quote">2014-03-04 20:18 GMT+01:00 Mike Toews <span dir="ltr"><<a href="mailto:mwtoews@gmail.com" target="_blank">mwtoews@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Have you tried using NearestPoints(g1, g2)?<br>
<a href="http://geos.refractions.net/ro/doxygen_docs/html/classgeos_1_1operation_1_1distance_1_1DistanceOp.html#a6" target="_blank">http://geos.refractions.net/ro/doxygen_docs/html/classgeos_1_1operation_1_1distance_1_1DistanceOp.html#a6</a><br>


(and for C-API it is called GEOSNearestPoints).<br>
<br>
It will return the closest points along on the linestring from another<br>
geometry (like a point). Normally you might expect one point that is<br>
closest, however it is conceivable there could be many equidistant<br>
closest points to another. Another detail is that the returned<br>
coordinate(s) may not be vertices of the original linestring. If you<br>
need the closest vertex(es), then you should convert the stream to a<br>
multipoint before using NearestPoints.<br>
<span class="HOEnZb"><font color="#888888"><br>
-Mike<br>
</font></span><div class="im HOEnZb"><br>
On 3 March 2014 22:35, Paul Meems <<a href="mailto:bontepaarden@gmail.com">bontepaarden@gmail.com</a>> wrote:<br>
><br>
> Hi List,<br>
><br>
> We use with MapWinGIS (C++ ActiveX control) GDAL with GEOS.<br>
><br>
> I've got a linestring (stream) and need to know the closest point at that stream from a specific location.<br>
> What I need is the index of the point in the stream and the distance from the location to that point.<br>
><br>
> We currently have a custom GetClosestPoint method which is not using GEOS, but that is not working when a long linestring is close to the location but the points are far away.<br>
> For example my line has two points, starts in Amsterdam and ends in Paris. My location is near Antwerp.<br>
><br>
> Does GEOS have a better method for this? I did searched using Google and found several methods/pages but I'm not sure what to use.<br>
> I also want to make it a generic method that will work with all types of lines and polygons.<br>
><br>
> Any advice would be much appreciated.<br>
><br>
> Thanks,<br>
><br>
> Paul<br>
><br>
</div><div class="im HOEnZb">> Paul Meems<br>
> Release manager, configuration manager<br>
> and forum moderator of MapWindow GIS.<br>
> <a href="http://www.mapwindow.org" target="_blank">www.mapwindow.org</a><br>
><br>
> Owner of MapWindow.nl - Support for<br>
> Dutch speaking users.<br>
> <a href="http://www.mapwindow.nl" target="_blank">www.mapwindow.nl</a><br>
><br>
><br>
> Join us at the MapWindow GIS Conference 2014, in Debrecen Hungary<br>
><br>
><br>
</div><div class="HOEnZb"><div class="h5">> _______________________________________________<br>
> geos-devel mailing list<br>
> <a href="mailto:geos-devel@lists.osgeo.org">geos-devel@lists.osgeo.org</a><br>
> <a href="http://lists.osgeo.org/mailman/listinfo/geos-devel" target="_blank">http://lists.osgeo.org/mailman/listinfo/geos-devel</a><br>
_______________________________________________<br>
geos-devel mailing list<br>
<a href="mailto:geos-devel@lists.osgeo.org">geos-devel@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/geos-devel" target="_blank">http://lists.osgeo.org/mailman/listinfo/geos-devel</a><br>
</div></div></blockquote></div><br></div>