0

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.

Snaileater
  • 5,743
  • 1
  • 15
  • 26
Stefan
  • 1
  • Yes, it does. With slight changes it worked. Thank you very much!

    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
  • Make sure to leave an upvote to the original answer ;-) – Erik Mar 26 '21 at 10:32
  • This is somehow not working. Sry, I'm new to this one. Your help was appreciated anyway. ;-) – Stefan Mar 26 '21 at 12:24
  • You could open a new question, containing a link to the one I linked here, your attempts at adaption to your case and what you are expecting to happen. Though, if I read correctly, you want to automatically create a field based on values you enter during feature digitizing - this is (to my knowledge) not possible. Automated field values need an already existent data base, be it a different layer, or geometry values or similar. – Erik Mar 26 '21 at 12:35

0 Answers0