georchestra / datadir

geOrchestra configuration directory for generic wars & Debian packages (eg: /etc/georchestra)
5 stars 32 forks source link

Update Mapstore's conf to optimise layers loading #218

Open jusabatier opened 2 years ago

jusabatier commented 2 years ago

As discuted previously with other administrators, we should setup the way example catalogs are configured in order to have faster tiles loading.

Here is an example of what can be done :

[...]
"newService": {
    "url": "",
    "type": "wms",
    "title": "",
    "isNew": true,
    "autoload": false,
    "format":"image/vnd.jpeg-png",
    "layerOptions":{
        "tileSize":512,
        "singleTile":false,
        "legendOptions":{
            "legendWidth":30,
            "legendHeight":30
        }
    }
},
[...]
"services": {
    "localgs": {
        "url": "/geoserver/ows",
        "type": "wms",
        "title": "le geoserver local",
        "autoload": true,
        "format":"image/vnd.jpeg-png",
        "layerOptions":{
            "tileSize":512,
            "singleTile":false,
            "legendOptions":{
                "legendWidth":30,
                "legendHeight":30
            }
        },
    }
[...]

The use of image/vnd.jpeg-png should allow to faster tiles loading as it rely on GS to choose between JPEG or PNG (transparency or not).

In the last Mapstore release, image/vnd.jpeg-png8 is also available, so when it will be integrated in Georchestra, we could use it.

Any opinions about this sample conf ?

@MaelREBOUX @landryb @catmorales ?

catmorales commented 2 years ago

It's OK for me . It can be applied with localgn too.

In our configuration (localConfig.json) we have:

"localgs": {
        "url": "/geoserver/ows",
        "type": "wms",
        "title": "Géoservices",
        "autoload": true,
        "layerOptions": {
                        "tileSize": 512,
                    "format": "image/png8"
                        },
        "format": "image/png8"
        },
"localgn": {
        "url": "/geonetwork/srv/fre/csw",
        "type": "csw",
        "title": "Catalogue Rennes Métropole",
        "autoload": true,
        "layerOptions": {
                        "tileSize": 512,
                    "format": "image/png8"
                      },
        "format": "image/png8"
       }

About legendOptions i applied it in the TOC plugin section:

"name": "TOC",
                "cfg": {
                    "activateDownloadTool": false,
                    "activateMetedataTool": true,
                    "layerOptions": {
                        "legendOptions": {
                                "scaleDependent": true,
                            "legendStyle": {
                                "maxWidth": "250%"
                                },
                                "WMSLegendOptions": "forceLabels:on",
                                "legendWidth": 30,
                                "legendHeight": 20,
                            "legendContainerStyle": {
                                    "overflowX": "auto"
                            }   
                            }
                    },
jusabatier commented 2 years ago

Ok so I suggest to :

1°/ Update catalogs to set :

"format":"image/vnd.jpeg-png",
"layerOptions":{
    "tileSize":512,
    "singleTile":false
},

Note : Provide singleTile option allow user to know it's available here.

2°/ Add legend options conf to TOC in localConfig.json :

"legendOptions": {
    "scaleDependent": true,
    "legendStyle": {
        "maxWidth": "250%"
    },
    "WMSLegendOptions": "forceLabels:on",
    "legendWidth": 30,
    "legendHeight": 30,
    "legendContainerStyle": {
        "overflowX": "auto"
    }
}

Also here are some PGSQL example requests to update those confs for already created contexts :

=> To update catalogs config, just replace last param with your own conf.

UPDATE mapstore.gs_stored_data
SET stored_data = regexp_replace(
    stored_data,
    '"catalogServices":{.*,"selectedService":"gpvgs"}',
    '"catalogServices":{"services":{"gpvc":{"url":"https://geoportail.lepuyenvelay.fr/geonetwork/srv/fre/csw","type":"csw","title":"Catalogue GeoPortail du Velay","autoload":true,"format":"image/vnd.jpeg-png","layerOptions":{"tileSize":512,"singleTile":true},"oldService":"gpvc","showAdvancedSettings":true},"gpvgs":{"url":"https://geoportail.lepuyenvelay.fr/geoserver/ows","type":"wms","title":"Geoserver GeoPortail du Velay","autoload":true,"format":"image/vnd.jpeg-png","layerOptions":{"tileSize":512,"singleTile":true},"oldService":"gpvgs","showAdvancedSettings":true},"gpvgwc":{"url":"https://geoportail.lepuyenvelay.fr/geowebcache/service/wmts","type":"wmts","title":"GeoWebCache GeoPortail du Velay","autoload":true,"format":"image/png","layerOptions":{"tileSize":256,"singleTile":false},"oldService":"gpvgwc","showAdvancedSettings":true}},"selectedService":"gpvgs"}'
)
landryb commented 2 years ago

i just want to stress the fact that image/vnd.jpeg-png is probably a vendor format only supported by the default config of geoserver. Having that by default for all new services probably means someone adding a non-geoserver url will have to fiddle with the default format for that service ?

mapserver supports it but not by default, per the example config on https://mapserver.org/mapfile/outputformat.html

other than that, i really like the way this is going :)

jusabatier commented 2 years ago

Ok, so maybe we can just add it as a comment and keep simple png8 by default.

After all, the config provided in datadir have to be adapted for the environment where it is deployed. And it still possible to set the format at the catalog creation in the UI. Also if I well understand, in last MS version, the available formats are retrieved directly from the GetCapabilities for WMS services.

landryb commented 2 years ago

Also if I well understand, in last MS version, the available formats are retrieved directly from the GetCapabilities for WMS services.

well there's geosolutions-it/MapStore2#6522, right, but i havent tested it (and i dunno if its in our mapstore2) so georchestra/mapstore2-georchestra#301 and georchestra/mapstore2-georchestra#302 are still open...