New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow more Expression scopes in virtual Layer SQL #35867
Comments
Maybe @mhugo could add MapSettingsScope to the available Expression scopes: src/providers/virtual/qgsvirtuallayersqlitemodule.cpp
|
Ok, I guess it's not that easy. It has to do with mapSettingsScope, but honestly I don't know how. |
@cxcandid Thanks for your proposal. That would be indeed a nice addition to SQL layers.
Did you try that modification you proposed ? |
@mhugo No unfortunately not, and I guess it doesn't work, because IMHO mapSettingsScope needs the settings of the layout map. And btw. I have absolutely no C++ knowledge. Maybe you find the answer in the code for parsing Expression functions in label strings? |
It won't be possible to add the map settings scope for virtual layers -- virtual layers are used everywhere, and not just in situations associated with any particular map. The proposed patch mentions a |
@nyalldawson Thanks for clarification. Totally forgot about the processing tool. |
I figured out, that I can use global and project variables in virtual layers:
SELECT var('qgis_version') as qgis,var('project_basename') as project
It's also documented that we can speed up our queries when using the hidden column
_search_frame_
.But what I really would like to do is:
SELECT ... WHERE _search_frame_ = var(map_extent)
which is not possible yet, because - I guess - the variable scope "MapSetting" is not supported.Maybe that's an oversight, because inside layer labels I can use i.e.
geom_to_wkt( @map_extent )
.It's possible to write a custom Expression function as workaround:
SELECT ... WHERE _search_frame_ = currentExtent()
but this only uses the map canvas extents and not the extents of a layout map window.
The text was updated successfully, but these errors were encountered: