I have two line-layers: TLM-layer
and SEGMENT-layer
The TLM-layer
has much more segments than the SEGMENT-layer
(example: x – z – x in TLM but only red in SEGMENT-layer
), but they have the same vertices (except segment a which is only in the SEGMENT-layer
)
I'd like to add a new attribute to the SEGMENT-layer
called object_kat
(integer) which should be defined as:
blue = "object_kat" = 1
yellow = "object_kat" = 2
red = "object_kat" = 3
violet = "object_kat" = NULL
If a segment in the SEGMENT-layer
contains more than one segment of the TLM-layer (as example red in SEGMENT-layer
and x – z – x in the TLM-layer
), the object_type of the longest segment should be used (e.g. x -> red -> "object_kat" = 3 and z which would be yellow and "object_kat" = 2 should be ignored because it's shorter)
I think I should use following steps:
- which object_type's (y -> "object_type" = '3', z -> "object_type" = '2', x -> "object_type" = '1') of the
TLM-layer
are within a segment of theSEGMENT-layer
(blue, yellow, red, violet) - which of these is longest
- add the value of it (blue -> 1, yellow -> 2, red -> 3, in the new "object_kat" attribute (integer) of the
SEGMENT-layer
I'd like to have this as easy as possible using an expression in the Field Calculator in QGIS