I'm really struggling trying to create a field which lists the neighbouring cells of my grid. I have a grid of 814 cells, and for most cells (i.e. the ones which are fully surrounded) there are eight neighbouring cells.
In the field calculator, I am setting the field type to string, and the field length to a number way higher than needed. The layer is called "Clip" and the output I want is a list of the "id" numbers which is a field in itself.
The preview of this code is correct. For most cells, the output is eight. But when I click Ok, the output in the new field is NULL. I've tried changing the filter to touches() and I've tried adding a buffer around the geometry(@parent) bit.
The code I'm using is...
aggregate(
layer:= 'clip',
aggregate:= 'concatenate',
expression:= to_string("id"),
concatenator:= ', ',
filter:= intersects($geometry, geometry(@parent))
)


array_to_string(your_current_code)? – J. Monticolo Nov 29 '21 at 11:03aggregate(...), one can use this expression:array_to_string(array_sort(overlay_touches(@layer, "id")))– Taras Nov 29 '21 at 11:35bufferfunction with your$geometry. Beware of geographic CRS like WGS84, buffer function is better with cartesian and projected coordinate systems. – J. Monticolo Nov 29 '21 at 12:01