I have two layers. One shapefile point layer, called "point1" and one csv no geometry layer, called "Meta".

"point1" looks like:

id   bd
1    a
2    b
3    c
4    d
5    e
6    f

and so on...

"Meta" looks like:

Name    ids
sample  1, 2, 3, 6

It is a one-line layer and 1, 2, 3, 6 is one single string. Layer "point1" will always stay the same and "Meta" will change everytime the project is opened.

Now I want to create a new layer (multipoint) from point1 layer which id's are listed in the ids string of Meta layer. Out of curiosity I want to know whether this is possible or not using Geometry by expression. (If you have an answer for virtual layers feel free to share as well.)

So far I have the following expression built up which returns an array like this: [<feature: 0>, <feature: 1>, NULL, <feature: 3>] and so on... Here is my expression:

    get_feature( 'point1','id',
                ,attribute( $currentfeature, 'id' )

Replacing array_agg() with geometry() returns a copy of point1 layer keeping only the wanted geometries. But how can I create a multipointlayer out of it?

Can I create a multipointlayer using expressions and arrays using QGIS 3.6 this way?

Your Answer

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

Browse other questions tagged or ask your own question.