[geos-devel] Looking for the closest point
Paul Meems
bontepaarden at gmail.com
Sun Mar 9 05:33:27 PDT 2014
Just an update.
We've implemented a new method in MapWinGIS that is using GEOSNearestPoints
and it is doing exactly what I was looking for.
Thanks,
Paul
*Paul Meems *
Release manager, configuration manager
and forum moderator of MapWindow GIS.
www.mapwindow.org
Owner of MapWindow.nl - Support for
Dutch speaking users.
www.mapwindow.nl
*Join us at the MapWindow GIS Conference 2014
<http://geogis.detek.unideb.hu/TKonferencia/2014/>, in Debrecen Hungary*
2014-03-04 20:18 GMT+01:00 Mike Toews <mwtoews at gmail.com>:
> Have you tried using NearestPoints(g1, g2)?
>
> http://geos.refractions.net/ro/doxygen_docs/html/classgeos_1_1operation_1_1distance_1_1DistanceOp.html#a6
> (and for C-API it is called GEOSNearestPoints).
>
> It will return the closest points along on the linestring from another
> geometry (like a point). Normally you might expect one point that is
> closest, however it is conceivable there could be many equidistant
> closest points to another. Another detail is that the returned
> coordinate(s) may not be vertices of the original linestring. If you
> need the closest vertex(es), then you should convert the stream to a
> multipoint before using NearestPoints.
>
> -Mike
>
> On 3 March 2014 22:35, Paul Meems <bontepaarden at gmail.com> wrote:
> >
> > Hi List,
> >
> > We use with MapWinGIS (C++ ActiveX control) GDAL with GEOS.
> >
> > I've got a linestring (stream) and need to know the closest point at
> that stream from a specific location.
> > What I need is the index of the point in the stream and the distance
> from the location to that point.
> >
> > 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.
> > For example my line has two points, starts in Amsterdam and ends in
> Paris. My location is near Antwerp.
> >
> > 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.
> > I also want to make it a generic method that will work with all types of
> lines and polygons.
> >
> > Any advice would be much appreciated.
> >
> > Thanks,
> >
> > Paul
> >
> > Paul Meems
> > Release manager, configuration manager
> > and forum moderator of MapWindow GIS.
> > www.mapwindow.org
> >
> > Owner of MapWindow.nl - Support for
> > Dutch speaking users.
> > www.mapwindow.nl
> >
> >
> > Join us at the MapWindow GIS Conference 2014, in Debrecen Hungary
> >
> >
> > _______________________________________________
> > geos-devel mailing list
> > geos-devel at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/geos-devel
> _______________________________________________
> geos-devel mailing list
> geos-devel at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/geos-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geos-devel/attachments/20140309/a2c4fd6b/attachment.html>
More information about the geos-devel
mailing list