[QGIS-Developer] Storing a copy of map canvas extent in QgsProject (for server)

Alessandro Pasotti apasotti at gmail.com
Thu Nov 12 05:53:21 PST 2020


Hi,

The new landing page server core API module makes use of the canvas
extent to determine the initial extent of the map being shown in the
web gis viewer.

If I'm not mistaken, that value is only available in map canvas and
it's not available in the server context. My current workaround mimics
what happens in the desktop when QgsProject::readProject is emitted.

This prevents me from using the server's config (project) cache and
results in an unnecessary additional project read when the server
landing page API is accessed for the first time.

I was thinking of storing that value directly in QgsProject instances
as "initialExtent()" by reading it from the "mapcanvas" xml tag, I'm
not super-happy with that because that would be a duplication but I
cannot see another way to access that information without re-reading
the project.

Any idea or comment before I proceed?

-- 
Alessandro Pasotti
QCooperative:  www.qcooperative.net
ItOpen:   www.itopen.it


More information about the QGIS-Developer mailing list