lizmap-web-client icon indicating copy to clipboard operation
lizmap-web-client copied to clipboard

Custom layer data in project config files

Open cxcandid opened this issue 2 years ago • 2 comments

It would be advantageous if we could store our own custom layer data in LIZMAP configuration files, which are not removed by the QGIS plugin (i.e. "customData" in example below):

        "Pipelines": {
            "id": "pipelines_9b334a3e_5766_48cf_9575_24b9c9064318",
            "name": "Pipelines",
            "type": "layer",
            "geometryType": "line",
            "extent": [
                1430547.32064473,
                6096317.01002737,
                1867798.14250571,
                6203828.41431629
            ],
            "crs": "EPSG:3857",
            "title": "🌈  Pipelines",
            "abstract": "",
            "link": "",
            "minScale": 1,
            "maxScale": 1000000000000,
            "toggled": "True",
            "popup": "True",
            "popupFrame": null,
            "popupSource": "lizmap",
            "popupTemplate": "",
            "popupMaxFeatures": 50,
            "popupDisplayChildren": "False",
            "popup_allow_download": false,
            "noLegendImage": "False",
            "groupAsLayer": "False",
            "baseLayer": "False",
            "displayInLegend": "True",
            "group_visibility": [],
            "singleTile": "True",
            "imageFormat": "image/png",
            "cached": "False",
            "serverFrame": null,
            "clientCacheExpiration": 300,
            "customData": {
                "externalWMS": {
                    "url": "https://<myserver>/mapproxy/lizmap/service"
                }
            }
        },

cxcandid avatar Sep 07 '22 08:09 cxcandid

Side question, what do you do next with customData in the CFG file ? Do you have some javascript ?

Gustry avatar Sep 07 '22 09:09 Gustry

@Gustry yes I have some Javascript in development to speed up loading vector layers with the help of MapProxy. And I have a baselayer substitution mechanism as well:

            "externalAccess": {
                "tiles": {
                    "zoomOffset": 6,
                    "maxResolution": 2445.9849047851562,
                    "serverResolutions": [156543.033928,78271.5169639999,39135.7584820001,19567.8792409999,9783.93962049996,4891.96981024998,2445.98490512499,1222.99245256249,611.49622628138,305.748113140558,152.874056570411,76.4370282850732,38.2185141425366,19.1092570712683,9.55462853563415,4.77731426794937,2.38865713397468,1.19432856685505],
                    "numZoomLevels": 20,
                    "url": ["https://maps1.wien.gv.at/basemap/geolandbasemap/normal/google3857/${z}/${y}/${x}.png",
                        "https://maps2.wien.gv.at/basemap/geolandbasemap/normal/google3857/${z}/${y}/${x}.png",
                        "https://maps3.wien.gv.at/basemap/geolandbasemap/normal/google3857/${z}/${y}/${x}.png",
                        "https://maps4.wien.gv.at/basemap/geolandbasemap/normal/google3857/${z}/${y}/${x}.png",
                        "https://maps.wien.gv.at/basemap/geolandbasemap/normal/google3857/${z}/${y}/${x}.png"],
                }
            }

But there are other ideas, i.e. saving Icon links to show additional symbols in the layer tree, or adding a flag to show checkboxes to enable/disable labels (switch between layer "Layer" and "Layer with label").

cxcandid avatar Sep 07 '22 10:09 cxcandid

There is an undocumented layer property for QGIS Server called WMS print layer that we can use to store additional data. This property is shown in the GetProjectSettings response. Or we add the data in a custom Javascript file with a reference to the layer name. All in all, the requested enhancement is definitely not necessary.

cxcandid avatar Jan 11 '23 11:01 cxcandid