I'm working with QGIS an I have a polygon and a line layer. The polygon layer defines a certain area and each polygon has its own specific ID (something like "ARC1" oder "GZT2"). I was wondering if its possible to join this ID to the line layer while creating new features within a polygon.
But it doesn't stop here. While creating a line, the type of the line is chosen via dropdown menu (something like "OG" or "HSBV"). My final goal is to connect this information with the ID from the polygon layer. A final addition is a sequential number. In the end the ID for a line should look like this: "ARC1_OG_001".
I think I could work my way around once the information from the polygon layer is contained in the line layer. My idea is using something like "concat" but I have no idea how to do this spatial join automatically. It would be nice to have a user friendly ID generation for those lines.
With the aggregate function I'm able to get the information from the polygon layer:
aggregate(layer:='polygon_layer', aggregate:='max', expression:="field_from_polygon_layer",filter:= contains( $geometry, (geometry(@parent))))
– Stefan Mar 26 '21 at 09:52