2

Using the field calculator one can update the geometry of a feature in dependence of one of its attributes. The process is described in Updating feature geometry from attribute fields in QGIS

My goal is to update rectangles depending on "width" and "height" attributes. I have the formula to do so. The formula works and I have saved it as a custom expression. And updating the geometry using the field calculator works like a charm as well. However it is quite tedious to

  1. Change the attribute.
  2. Open field calculator
  3. Select field
  4. Select the custom formula to update geometry depending on width or height
  5. Select update field

It is possible to link attribute fields (e.g. length of a line, area of a polygon etc.) to the geometry, such that they automatically update when the geometry is edited - see Automatically updating geometry attributes in QGIS without using Virtual Fields

Is there a way to switch this arround, so that the geometry automatically adapts, when i edit the width and height attributes without me having to manually perform the 5 steps above?

2
  • Using a virtual layer...?
    – Babel
    Sep 8, 2022 at 21:15
  • Hmm could work, however i would prefer not to clutter up my project with yet another Layer. Currently looking to write a custom action using pyqgis, so the workflow to update geometry would be reduced to 1 step instead of 5. However the preferred solution remains an automatic geometry update...
    – Robert
    Sep 9, 2022 at 14:16

0

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.

Browse other questions tagged or ask your own question.