5

I am digitising line-features based on WGS-84 point-coordinates from a PDF which cannot be copied from.

The final line layer should contain lines which each connect two points and have the following attributes:

  • Name of start point - name of end point
  • value in [ft]
  • value in [m]
  • remark (same for all features)
  • date of creation

Currently I have a csv-based point layer which simply contains the name and coordinates of each point.


Creating the point layer is no problem, but creating the lines is a bit of a hassle. Either I manually create a .csv containing all existing connections between points like the following table and run connect by lines:

enter image description here

Or I digitise the lines manually but fill in the values (except for the value in [ft]) automatically.


Personally I would prefer option 2, since option 1 involves more manual work and the process has to be repeated regularly (and I figure I could transfer the solution to other tasks), but I can't get the expression right which should fill in the name of the line. All other values are created flawlessly (though they are not taken from another layer based on geometry).

I added the WKT of each point to the point-layer. Currently I am running the following, which returns NULL, despite it seems to be correct to me:

attribute(get_feature('point-layer','geom',geom_to_wkt(start_point($geometry))),'Waypoint')||' - '||attribute(get_feature('point-layer','geom',geom_to_wkt(end_point($geometry))),'Waypoint')

Any ideas where I went wrong?

0

1 Answer 1

8

You could try the aggregate function to get the value of WayPoint where the object in point-layer intersects the start_point (and end_point) of the digitised line. This might work better than trying to compare the WKTs:

aggregate(layer:='point-layer', aggregate:='max', expression:="WayPoint",
          filter:= intersects( $geometry, start_point(geometry(@parent)))) 
||' - '||  
aggregate(layer:='point-layer', aggregate:='max', expression:="WayPoint",
          filter:= intersects( $geometry, end_point(geometry(@parent))))

This only works in QGIS 3, the geometry(@parent) function wasn't available in QGIS 2.x

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.