[Qgis-user] Nearest point on line

Andrew McAninch andrew at rabbit-troop.net
Fri Oct 18 11:50:55 PDT 2019


You can do this in the field calculator with the refFunctions plugin.   It gives you a function, geomnearest(), which will return the WKT geometry of the nearest line(or geomdistance() if you want to limit your search radius).  Then use the closest_point() function to find the nearest point on that line.  something like:

closest_point(geom_from_wkt(geomdistance('lines','$geometry',10)) , $geometry)


Andrew



‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Thursday, October 17, 2019 11:51 PM, Christoph Jung <jagodki.cj at gmail.com> wrote:

> Hello list,
>
> Does QGIS has a function to calculate the nearest point on a line layer by a given point layer? In PostGIS i could query it with min(st_distance(...)) or st_closestpoint(...). But I miss such a function directly in QGIS (I just found the plugin Cloest Point, but it has some issues...).
>
> Sincerely,
> Christoph
>
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user




More information about the Qgis-user mailing list