# Counting longest distance between two lines using QGIS?

How do I count longest distance between two lines as shown at the picture in every bump using QGIS?

• which software are you using? – JGH May 10 '18 at 16:16
• I am using QGIS but i have acces to ArcGIS. – SKNG_geoinfo May 10 '18 at 16:51
• Here is a workflow, create Polygons from all lines (Feature to Polygon), Create Centroids (Feature to Point), run Near to Find the distance from Centroid Point to Line Edge, Double the near Distance. – klewis May 10 '18 at 17:44
• What have you tried with QGIS? If you wish to also ask about ArcGIS Desktop then please do so in a separate question with details about what you have tried and where you are stuck. – PolyGeo May 10 '18 at 20:16
• If you exclude the "at every bump" criteria, what you're looking for is the "Hausdorff distance". A possible workflow would be to split the lines by each other, then for each pair of split segments calculate the Hausdorff distance. – ndawson May 11 '18 at 9:29

I see interesting suggestions I would love to try. Below is what I have tried so far.

A sample data `rivers`; I tried to mimic two rivers (type = `straight` and type = `meander`).

Then,

(1) Create a new layer of points along the `meander` river at 1 meter interval (or any interval to fit your required accuracy). I used `v.to.point` which returned a new point layer (layer name: `Points along lines`).

(2) Open the attribute table of `Points along lines` layer. Create a new field `dist` with an expression:

``````distance(
closest_point(geometry(get_feature('rivers', 'type', 'straight')), \$geometry),
\$geometry
)
``````

The above expression add a new field which shows distance from each point to the straight river.

(3) Click on a point which you think the farthermost, observe corresponding distance (`dist`) value highlighted on the attribute table. (I missed the right one but it is easy to find the distance I want = `3.90036 meters`.)