Question: I have two layers, a line and a point layer.

I need to make a line layer which connects all the points to the nearest line feature. How can I do that?

Is there a plugin available for QGIS?
This is a very important tool which is missing in QGIS.

ArcView has this tool: ["Nearest Features"](http://www.jennessent.com/arcview/nearest_features.htm)

![](https://i.stack.imgur.com/nMzUe.jpg)

Answer: 
Meanwhile (since QGIS 3.16), there is the new [`overlay_nearest()`](https://docs.qgis.orglatest/en/docs/user_manual/working_with_vector/functions_list.html#overlay-nearest) function you can use for that with QGIS expressions. For each point, 1) get the nearest line with `overlay_nearest()`, 2) get the closest point on this line to the point using [`closest_point()`](https://docs.qgis.org/latest/en/docs/user_manual/working_with_vector/functions_list.html?highlight=overlay_nearest#closest-point).

The expression to be used with [Geometry generator](https://docs.qgis.org/latest/en/docs/user_manual/style_library/symbol_selector.html#the-geometry-generator) or [Geometry by expression](https://docs.qgis.org/latest/en/docs/user_manual/processing_algs/qgis/vectorgeometry.html#geometry-by-expression) ([see here for details](https://gis.stackexchange.com/a/392619/88814)) look like:

```
make_line (
    $geometry,
    closest_point (
        overlay_nearest ('line', $geometry)[0],
        $geometry
    )
)

```

* Replace `line` in line 4 with the name of your line layer.

*Dotted lines to connect points to nearest lines are created with the above expression:*

[![enter image description here](https://i.stack.imgur.com/hrFUe.png)](https://i.stack.imgur.com/hrFUe.png)
If you find the point over the line, the shortest point, with the coordinate 3D (X,Y,Z) you need an algorithm to calc the position over the shortest line. You can using this tool <https://github.com/rafaelduartenom/findpointonline>. You need postgres to execute this tool and shapefiles.