camptocamp / ngeo

Library combining OpenLayers and AngularJS
https://camptocamp.github.io/ngeo/master/examples
MIT License
135 stars 87 forks source link

Use WMS instead of WMTS for print #2463

Closed kdeininger closed 7 years ago

kdeininger commented 7 years ago

I'm trying to use WMS instead of WMTS for printing background layers.

According to @eleu, it should be possible by adding the properties "wmsUrl" and "wmsLayers" to the background layer's metadata, but this has no effect. Is there some configuration missing? A test by @eleu on the GMF 2.1 demo application didn't work either.

I'm using GeoMapFish version 2.1.1 and the resulting themes response looks like this:

{
  "background_layers": [
    {
      "layer": "grundkarte_farbig", 
      "dimensions": {}, 
      "name": "grundkarte_farbig", 
      "url": "http://tile.geoview.bl.ch/1.0.0/WMTSCapabilities.xml", 
      "type": "WMTS", 
      "id": 9999998, 
      "imageType": "image/png", 
      "metadata": {
        "wmsUrl": "http://geoview.bl.ch/main/wsgi/mapserv_proxy", 
        "wmsLayers": "grundkarte_farbig_group", 
        "thumbnail": "http://geoview.bl.ch/main/wsgi/sfr/static/images/baselayer_farbig.png"
      }
    }, 
    ... 
  ]
  ...
}
sbrunner commented 7 years ago

The properties wmsUrl is for CGXP, in ngeo we use the property ogcServer. and the property for the layer is layer, see: https://camptocamp.github.io/c2cgeoportal/master/integrator/ngeo.html?highlight=ogcserver#wmts-layers

kdeininger commented 7 years ago

I've tried to replace the properties, but without any effect. On creating a report, it still uses WMTS for the backgroud layers. The resulting response of the themes request looks like this now:

{
  "background_layers": [
    {
      "layer": "grundkarte_farbig",
      "dimensions": {},
      "name": "grundkarte_farbig",
      "url": "https://tile.secure.geoview.my.bl.ch/1.0.0/WMTSCapabilitiesDev2SecureIntra.xml",
      "type": "WMTS",
      "id": 9999997,
      "imageType": "image/png",
      "metadata": {
        "layers": "grundkarte_farbig_group",
        "thumbnail": "https://secure.geoview.my.bl.ch/u207027/wsgi/sfr/static/images/baselayer_farbig.png",
        "ogcServer": "internal"
      }
    },
    ...
  ],
  "themes": [
    ...
  ],
  "errors": [],
  "ogcServers": {
    "internal": {
      "url": "https://secure.geoview.my.bl.ch/u207027/wsgi/mapserv_proxy",
      "isSingleTile": false,
      "wfsSupport": true,
      "urlWfs": "https://secure.geoview.my.bl.ch/u207027/wsgi/mapserv_proxy",
      "type": "mapserver",
      "imageType": "image/png"
    }
  }
}

I've also tried printLayers and layer instead of layers, but nothing changed. I couldn't find any line in the code respecting the property printLayers, for example. Where does the decision, whether to replace WMTS by WMS or not, take place?