2

I have two shapefiles:

  1. street (polyline) listing of all streets in one village with fields 'streetId', 'Streetlength' (virtual field)

  2. streetpanel listing of all panels displaying street name with fields 'panelid' , 'streetref' making a reference to the streetid of table 1

I want to put in table 2 a calculated field that retrieves the street length the panel refers to.

I am not a real expert in QGIS/Python, so I looked at what I can do with existing functions (getfeature(), attributes(), aggregate(),...) but I do not know how to address this.

How can I approach this problem?

1 Answer 1

3

Layer 1 is called street, its id being streetid and has a column streetlength

Layer 2 has a field called streetref, refering to the streetid in Layer1

Add a computed column with this code in Layer2:

attributes(get_feature('street','streetid', "streetref" ))['streetlength']

Gets the feature from layer street where attribute streetid is equal to "streetref" (from Layer2)

And gets the streetlength attribute from that feature

enter image description here

3

Your Answer

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

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