4

In QGIS I would like to merge selected data/attributes out of the attribute tables from overlaying vector objects on different vector layers without creating new additional layers. Is there any standard QGIS operation or QGIS plugin to accomplish this task?

Basically, to explain it better I have a vector layer with polygons representing buildings and its assigned attribute table. A second vector layer with polygons represents communal planning zones and their assigned attribute table. Both layers can not be joined by attributes as there have no corresponding keys.

So I would like to perform a spatial query over both vector layers to find all buildings overlapping polygons of the zone layer and write back to the same building layer attribute table the corresponding zone code from the zone layer attribute table.

How can this be done?

2

2 Answers 2

5

This is an old post but with a common problem, so I post this here...

This can be done now without creating a new shapefile, at least since QGIS 3.10.

  • Click on Field Calculator for your "Building-layer".

  • Create a new field (text with relevant length).

  • Add expression:

    array_to_string(overlay_within('Planning_zone-layer', Name_of_planning_zone))
    
  • Click OK

If a building is within a planning zone, then this will put the actual planning zone's name in a new column (field).

In older versions, the plugin 'refFunctions' could be used for this. It had a different function for this, called geomoverlaps. E.g. geomoverlaps('Planning_zone-layer', 'Name_of_planning_zone')

4

Try in QGIS menu Vector -> Data Management Tools -> Join attributes by location, but the result is a new shapefile.

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.