<p dir="ltr">Hi Federico,<br>
Does the Project method of OGRLineString not suits you? The point snap to nearest point, the point on line via the project, and point on polygon via cast the outer or inner rings to line and project too.<br>
Best regards,<br>
Dmitry</p>
<div class="gmail_quote">11 дек. 2014 г. 0:56 пользователь "Even Rouault" <<a href="mailto:even.rouault@spatialys.com">even.rouault@spatialys.com</a>> написал:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Le mercredi 10 décembre 2014 22:28:48, Federico Jurio a écrit :<br>
> Dear all, i'm trying to make a snapping tool to project new points in a<br>
> layer to the nearest geometry. First of all, when i activate my tool i make<br>
> a buffer of all the geometries in the layer. If the point that i'm trying<br>
> to add in the layer is within the buffer i want to move this point to the<br>
> nearest vertex/segment in that geometry but i don't know how to find the<br>
> new coordinates.<br>
> It would be helpful if someone could help me!<br>
<br>
Frederico,<br>
<br>
Available as ST_Snap in PostGIS (<a href="http://postgis.org/docs/ST_Snap.html" target="_blank">http://postgis.org/docs/ST_Snap.html</a>), that<br>
relies on GEOSSnap : <a href="http://geos.osgeo.org/doxygen/geos__c_8h_source.html" target="_blank">http://geos.osgeo.org/doxygen/geos__c_8h_source.html</a><br>
<br>
Would be easy to add in OGR geometry class as well (relying on GEOSSnap)<br>
<br>
Even<br>
<br>
--<br>
Spatialys - Geospatial professional services<br>
<a href="http://www.spatialys.com" target="_blank">http://www.spatialys.com</a><br>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a></blockquote></div>