4

In QGIS 3.12.2. I created a virtual layer to use for the sort-order in a print layout as described here: Sort attribute table by hidden column in Print Composer

That works, but I have a problem with the geometry. The virtual layer does not seem to have a geometry and I was not able to create one in the edit field of the virtual layer (I tried set automatically as well as defining a point-geometry and the CRS of the original layer it is created from). In the layers panel, the virtual layer shows with a point-rendering symbol, however does not show on the map. Also zooming to the layer has no effect.

I need the geometry to insert the page-number of the atlas sheet each point apears on, see: QGIS expression to access page-number of atlas for certain features

Here is what I tried, based on the first link above:

enter image description here

0

1 Answer 1

8

You need to include the geometry column from the source layer

select name, pop_tot, pop_ordering, geometry
from towns
where pop_tot<12000
order by pop_ordering
1
  • OK, that works, now the geometry appears. However, the selection does not seem to work as it should, at least not if I add an attribute tabel to the print composer. When I set the virtual layer as source, all attributes from the original layer (not only the selected ones) appear and the sort-order defined in the virtual layer is completely ignored. Commented May 23, 2020 at 15:56

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.