• You're one step from joining GIS Mapping Forum – Remote Sensing, Surveying & Software Solutions.
    Create a free account to post, follow threads, and never miss an update.  Sign up free →

QGIS Help: Finding the Shortest Distance Point Between Lines in the Same Layer

Meowzilla

New member
Joined
Jun 18, 2025
Messages
4
Hey QGIS gurus! I'm trying to figure out this puzzle that's been bugging me, and I could really use some help.

I've got two lines that are almost parallel, but the distance between them changes slightly.
What I need to do is identify and generate a point exactly where the distance between these two lines is the absolute shortest. The tricky part is, both lines live in the same layer.

I tried using overlay_nearest(@layer, max_distance:=1), but that just selected both lines, which isn't quite what I need. I also thought about the "Extract Vertices" algorithm, but no luck there either.

So, how can I specify the point marking the shortest distance between two (or more) lines in QGIS, assuming they always comprise the same layer? Any clever tricks or tools I'm missing?
 
Hey QGIS gurus! I'm trying to figure out this puzzle that's been bugging me, and I could really use some help.

I've got two lines that are almost parallel, but the distance between them changes slightly.
What I need to do is identify and generate a point exactly where the distance between these two lines is the absolute shortest. The tricky part is, both lines live in the same layer.

I tried using overlay_nearest(@layer, max_distance:=1), but that just selected both lines, which isn't quite what I need. I also thought about the "Extract Vertices" algorithm, but no luck there either.

So, how can I specify the point marking the shortest distance between two (or more) lines in QGIS, assuming they always comprise the same layer? Any clever tricks or tools I'm missing?
You're on the right track but try using the "Distance to nearest hub" tool with one line as origin and the other as hub, then grab the "Hub lines" output and extract the shortest one. From there, just extract the midpoint of that line. I know it's not that nice but it works.
 
Back
Top