I want to create a project where a user drops a point in QGIS within a predefined polygon and one of the fields is automatically completed with the value from a column in that specific polygon.

I have been playing around with relation reference in the field properties but can't get anything to work.

Please help!


  • I think I actually need to use Value Relation. I've been playing around with the 'within($geometry,...' but with no success as yet.... Nov 26 '15 at 12:45

There is an AutoFields plugin released in 2016. For the introduction and general usage, please see the author's plugin homepage AutoFields plugin for QGIS.

For your case:

  1. Start AutoFields plugin and choose your point layer.
  2. Create new field to store id field of the overlapping polygon.
  3. Insert a custom expression geomwithin('your_polygon_layer', 'id')

You would notice geomwithin() function has come from refFunction plugin.


You should use the plugin refFunction and then the code geomintersects('polygon layer','column to be copied').
You have to be sure that the topology is OK without polygon overlapping to avoid errors.

  • I agree refFunction provides key functionality. In the meantime will you expand your answer a bit to cover auto-filling part of the question? (Maybe using virtual field?)
    – Kazuhito
    Apr 15 '18 at 2:11

Your Answer

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

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