5

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?

Taras
  • 32,823
  • 4
  • 66
  • 137
MrXsquared
  • 34,292
  • 21
  • 67
  • 117

1 Answers1

9

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

Taras
  • 32,823
  • 4
  • 66
  • 137
JGH
  • 41,794
  • 3
  • 43
  • 89