1

Is it possible to get the extent of the current map canvas in a virtual layer query? Something similar to the variable @map_extent in QGIS expressions that can be used to create a polygon covering the current map canvas extent with Geometry generator.

In SpatialLite's SQL functions reference list, I don't see any function to get the map canvas extent. There is the function Extent, but it requires an existing geometry as input.

See here for background about what this is used for.

Babel
  • 71,072
  • 14
  • 78
  • 208
  • 1
    Does it help?https://gis.stackexchange.com/questions/411311/selecting-features-visible-in-map-extent-using-qgis – katagena Aug 28 '22 at 16:31
  • Indeed it does, thanks, see: https://gis.stackexchange.com/a/439278/88814 – Babel Aug 28 '22 at 16:49
  • This question looks like it can be closed because it's the above comments – JasonInVegas Aug 28 '22 at 19:13
  • Would leave it open - maybe ther are other people with different solutions. The linked answer is a workaround. Would still be great to get a direct solution in SpatialLite, thus what I originally asked for - or a confirmed answer that this is not possible. – Babel Aug 28 '22 at 19:22

1 Answers1

3

Spatialite can't know what extent is being displayed, as this falls under the GUI "responsibility".

Therefore, the only way to know the displayed extent is via a function on the GUI side (either a custom function like in this post, or a QGIS embedded function, or a function associated to a keyword... it's all the same under the hood)

JGH
  • 41,794
  • 3
  • 43
  • 89