1

I have a line layer with roads. Every road has a unique start and endpointnumber, as attribute. From this layer I want to select some roads. Therefore I have an excel table with start- and endpoint, which I want to select. The road layer and the excel table don ́t have an id, for a join. Is there any option in the query builder, that I can use columns from the table for my query on the line layer?

part of the excel table

enter image description here

part of the attribute table of road layer enter image description here

I want to select all roads with the values of "vnk" and "nnk" from the excel table, but I can ́t join them.

asked Apr 16, 2020 at 8:38
6
  • 1
    Could you paste a couple of screenshots of the attribute table for your road layer and your Excel layer so we can see how your data is structured more clearly? I think what you want to do is possible but you have to use Select Features by Expression and expressions that essentially perform joins (either get_feature() or aggregate()) Commented Apr 16, 2020 at 8:55
  • You could create an ID by combining the "vnk" and "nnk" fields? Commented Apr 16, 2020 at 9:09
  • No, the attributes "vnk" and "nnk" are not unique in the line layer. The excel table is a list of "vnk" and "nnk" values,which I want to select from the line layer. But I don´t want to select all separatly. Commented Apr 16, 2020 at 9:12
  • 1
    Yeah, but the combination "vnk-nnk" should be unique? Commented Apr 16, 2020 at 9:12
  • So you want to select roads where either vnk or nnk field values are in excel file nnk field? Commented Apr 16, 2020 at 9:27

1 Answer 1

2

If you want to select all road features that have the exact same vnk and nnk combination as a row in your Excel table - then you can use this expression in Select by Expression:

get_feature('excel','vnk',"vnk") is not null AND get_feature('excel','nnk',"nnk") is not null

enter image description here

If you want to select all road features where the vnk value must be in the Excel table, and the nnk value must also be in the Excel table, but not necessarily in the exact same pair combination, then you can use this expression.

get_feature('excel','vnk',"vnk") is not null OR get_feature('excel','nnk',"nnk") is not null

enter image description here


For both expressions you need to change the name of your excel layer accordingly (please note it is case-sensitive)

answered Apr 16, 2020 at 9:51

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.