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.

4
  • 1
    Does it help?gis.stackexchange.com/questions/411311/…
    – katagena
    Aug 28, 2022 at 16:31
  • Indeed it does, thanks, see: gis.stackexchange.com/a/439278/88814
    – Babel
    Aug 28, 2022 at 16:49
  • This question looks like it can be closed because it's the above comments Aug 28, 2022 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, 2022 at 19:22

1 Answer 1

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)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.