2

Suppose I have two attributes for the polygons on one layer representing buildings: one is number of floors and the other is building height, the latter equals to "number of floors" times 3 meters.

Is there a way to automatically update building height value if the number of floors is changed?

2 Answers 2

3

I don't think you can link two existing attributes together, but you can create a virtual field with the field calculator.

The values of a virtual field are automatically updated, but keep in mind that a virtual field will not be saved with its layer: it can only be saved within a QGIS project.

1

If I understand your question correctly, the AutoFields plugin should do the job for you. It "...allows you to configure vector fields to be automatically calculated for you when digitizing new features or modifying existing ones." Watch these videos for some demonstrations.

In your case, you would need to configure the existing Height field (i.e., you don't need to create an additional field) as an AutoField with this expression:

"floors" * 3

Doing so, every time you change the building floors attribute, the corresponding height will be updated.

http://plugins.qgis.org/plugins/AutoFields/

Your Answer

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

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