4

Is it possible to select all columns except geometry using virtual layers in QGIS?

For example I have this (simplified) query:

Select *, st_buffer(geometry, 100) From mypolygons

It does not work. It does not buffer at all. But using the (simplified) query as follows does buffer all polygons as intended:

Select id, name, st_buffer(geometry, 100) From mypolygons

Now the issue is, that if I have polygons with a lot of columns I need them to type in all manually. Is there a way to avoid this?

7

It does work as intended, and it is only a display issue.

To make is work, just give a name to the buffered geometry and specify this name as being the spatial column.

Otherwise, the virtual layer has two geometry columns, the original geometry and the new st_buffer(geometry) and the 1st one is picked-up for display.

Select *, st_buffer(geometry, 100) as geo2 From mypolygons

enter image description here

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.