I have a set of parallel lines where the default distance between them is 1.4m, I need to identify where that distance is greater or less than the default:
I have a sample file where it was done but I do not know how it was calculated nor how the points were generated:
Searching in GIS, I found this topic with an answer that seems to be the solution, but I do not know how to reproduce for a set of lines. I quote:
"You bet. There are a bunch of ways you can do it, but here's one potential method @Rashomon. For the set of points along each river bank, add new fields to the attribute table for Xcoord and Ycoord. Then open field calculator and use the $x and $y functions to populate the fields. You can then use anything you want to compute a simple average of the two sets of coordinates. Even Excel will work. Then just plot your new x and y coordinates that correspond to the center of the river. – lambertj Jan 25 at 16:44"
Solutions I thought: -Create a buffer in the 70cm lines and then identify where they overlap or do not touch, but I do not know how to calculate this.
-Create centerlines between parallel lines, extract nodes every 1mt for example, and measure the distance to parallel lines.
There are many lines, thousands, it would need to be an automated solution as much as possible, it could be matlab, python, r or some other, or qgis or arcgis. The sample files: https://drive.google.com/drive/folders/1XKOUECG3bY2claSqwQ-S9-C-yjYjE0r7?usp=sharing Many Thanks!
Here I used QGIS
distance() expression, which returns minimum distance between geometries. I worked only on the line layer, which may not be an answer you anticipated, but hope it helps.
(2) Re-order the lines
fidof the line layer was not related to their relative position. Created a new field (
center_y) to store y-coordinates of center point by
center_yfield by Order by expression tool (
ascendingso that the southernmost line comes first on the attribute table). This function returned a new layer
(3) Calculate the distance between lines
distance(geometry(get_feature_by_id('Output layer', $id+1)),$geometry)
(4) Find extreme values
@value <1.3 OR @value >1.5
I used QGIS 3.0.3 to use Order by expression but if you are working in QGIS 2.18 MMQGIS or Sort and Number plugins can order the field. [EDIT] (My apologies... I realized
get_feature_by_id() was newly added in QGIS 3.0, so this answer requires QGIS 3.0 anyway).