1

In my attribute table (neighbors) there is a comma-separated list in which the IDs of adjacent polygons are located. But now I want one line to appear for each adjacent polygon. So there would be e.g. (check the picture below) the line with the oid DENW17ALxE000051DENW17AL00003neWTF twice. Once with the adjacent polygon DENW17ALW600005aDENW17ALZb00007HTF and once with this one DENW17ALW600005dDENW17AL00003pGQTF. It was just an example, I would need it for every single line.

If there is no way to regulate this using the comma-separated list, I think another formula would have to be specified in the previous step (field calculator). So that the result is not the comma-separated list, but an attribute table extended by rows. I entered the following into the field calculator:

aggregates (
 layer: = 'street polygons',
 aggregate: = 'concatenate',
 expression: = oid,
 concatenator: = ',',
 filter: = intersects ($ geometry, geometry (@parent))
 )

attribute table simplified scheme. in blue the table of attributes as it is now, in orange as it should be with addition (wertigkeit_neighbor)

2
  • You want to row 24 to appear three times? What should happen with the geometry? Probably easier to understand if you explain what kind of analys you are trying to do
    – BERA
    Nov 26 '20 at 14:44
  • Okay i'm trying. but I'm sure it's a little complicated to understand. I want the adjacent polygon (neighbor) per oid that has the highest value. So in the end a pair of oid and an ID (neighbor) comes out. So far, the value is only available on another layer. If I solve the problem described and have an ID per line, I can add the value and filter accordingly.
    – Alice123
    Nov 26 '20 at 15:10
2

Try "Split features by character" (in the Processing Toolbox > Vector general) tool.

An example:

(1) Prepared a small test case: one point with neighbors field, with a record 'aaa, bbb'

enter image description here

(2) Started Split features by character tool.

Split value is a comma. Also please take notice of a small space after the comma. (Pointed by the red arrow, between the comma and the black caret mark).

enter image description here

(3) Ran the tool, then it returned a new Split layer, with duplicated geometries of aaa and bbb values.

enter image description here

1
  • Thank you so much for your helpful answer, it is working!! It made my day.
    – Alice123
    Dec 1 '20 at 14:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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