I am looking for a work-around to remove some fields (attribute columns) from a layer's table by a query.

For example, there are 10 columns in a table, remove 9 and leave only one (virtually).

Now, if I run 'Join Attribute by Location' tool, I should only get one column attached to the new 'join layer'. This is so that I could get only the desired attribute column in the output 'join layer'.

Once I finish this task, I should be able to display all original columns back as they were in the layer.

I know there is an equivalent in ESRI's ArcGIS, but not sure about QGIS.

  • Just to be clear: you want to do a spatial join where only 1 of the 10 join table columns is joined? Are you using Arc or QGIS? – Stu Smith Aug 5 '19 at 0:39

join attributes by location actually offers exactly this functionality: You can choose which attributes to join (leaving the field blank joins all columns)

enter image description here

  • 2
    In the English version, this option is called "Fields to add." – csk Aug 5 '19 at 15:55

You can create a virtual layer with the desired column(s). The layer just points to the original layer, so it can be dismissed when you are done with it.

go to the menu Layer > Add Layer > Add/Edit Virtual Layer... and enter the query

SELECT myfield, geometry
FROM myLayer

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.