WMTS cannot be configured as background layer
Opened this issue · 0 comments
allyoucanmap commented
Description
The WMTS layers needs an additional property sources
inside the map configuration that contains all the information about tile matrix.
Investigation
The following steps describes how the map object is injected in the template of a map/layer viewer of GeoNode version 3.2.x:
- the template initializes the context using the ms2_config_converter.convert https://github.com/GeoNode/geonode-mapstore-client/blob/2.1.x/geonode_mapstore_client/hooksets.py#L162-L164
- the ms2_config_converter.convert function creates the map configuration that uses the settings such as MAP_BASELAYERS, CATALOGUE_SERVICES and CATALOGUE_SELECTED_SERVICE https://github.com/GeoNode/geonode-mapstore-client/blob/2.1.x/mapstore2_adapter/plugins/geonode.py#L107
- the client read the configuration from the
window.__GEONODE_CONFIG__
object accessible at window level where the resourceConfig represent the map configuration (similar to the new.json). The__GEONODE_CONFIG__
is defined in the _geonode_config.html template file https://github.com/GeoNode/geonode-mapstore-client/blob/2.1.x/geonode_mapstore_client/templates/geonode-mapstore-client/_geonode_config.html#L19
Valid map configuration with WMTS background layer
{
"version": 2,
"map": {
"center": {
"x": 11.22894105149402,
"y": 43.380053862794,
"crs": "EPSG:4326"
},
"maxExtent": [
-20037508.34,
-20037508.34,
20037508.34,
20037508.34
],
"projection": "EPSG:900913",
"units": "m",
"zoom": 5,
"mapOptions": {},
"layers": [
{
"id": "5b04b490-d7f0-11eb-b51c-0d06fefb3c41",
"format": "image/png",
"group": "background",
"name": "mapstore:states",
"description": "states",
"style": "",
"title": "states",
"type": "wmts",
"url": "/geoserver/gwc/service/wmts",
"bbox": {
"crs": "EPSG:4326",
"bounds": {
"minx": "-125.020233154297",
"miny": "24.8338890075684",
"maxx": "-66.681037902832",
"maxy": "49.4938163757324"
}
},
"visibility": true,
"singleTile": false,
"allowedSRS": {
"EPSG:900913": true,
"EPSG:4326": true
},
"matrixIds": [
"EPSG:4326",
"EPSG:900913"
],
"tileMatrixSet": true,
"requestEncoding": "KVP",
"dimensions": [],
"hideLoading": false,
"handleClickOnLayer": false,
"queryable": true,
"capabilitiesURL": "/geoserver/gwc/service/wmts",
"useForElevation": false,
"hidden": false,
"params": {}
}
],
"groups": [],
"backgrounds": [],
"bookmark_search_config": {},
"sources": {
"/geoserver/gwc/service/wmts": {
"tileMatrixSet": {
"EPSG:900913": {
"ows:Identifier": "EPSG:900913",
"ows:SupportedCRS": "urn:ogc:def:crs:EPSG::900913",
"TileMatrix": [
{
"ows:Identifier": "EPSG:900913:0",
"ScaleDenominator": "5.590822639508929E8",
"TopLeftCorner": "-2.003750834E7 2.0037508E7",
"TileWidth": "256",
"TileHeight": "256",
"MatrixWidth": "1",
"MatrixHeight": "1",
"ranges": {
"cols": {
"min": "0",
"max": "0"
},
"rows": {
"min": "0",
"max": "0"
}
}
},
{
"ows:Identifier": "EPSG:900913:1",
"ScaleDenominator": "2.7954113197544646E8",
"TopLeftCorner": "-2.003750834E7 2.0037508E7",
"TileWidth": "256",
"TileHeight": "256",
"MatrixWidth": "2",
"MatrixHeight": "2",
"ranges": {
"cols": {
"min": "0",
"max": "0"
},
"rows": {
"min": "0",
"max": "0"
}
}
},
{
"ows:Identifier": "EPSG:900913:2",
"ScaleDenominator": "1.3977056598772323E8",
"TopLeftCorner": "-2.003750834E7 2.0037508E7",
"TileWidth": "256",
"TileHeight": "256",
"MatrixWidth": "4",
"MatrixHeight": "4",
"ranges": {
"cols": {
"min": "0",
"max": "1"
},
"rows": {
"min": "1",
"max": "1"
}
}
},
{
"ows:Identifier": "EPSG:900913:3",
"ScaleDenominator": "6.988528299386162E7",
"TopLeftCorner": "-2.003750834E7 2.0037508E7",
"TileWidth": "256",
"TileHeight": "256",
"MatrixWidth": "8",
"MatrixHeight": "8",
"ranges": {
"cols": {
"min": "1",
"max": "2"
},
"rows": {
"min": "2",
"max": "3"
}
}
},
{
"ows:Identifier": "EPSG:900913:4",
"ScaleDenominator": "3.494264149693081E7",
"TopLeftCorner": "-2.003750834E7 2.0037508E7",
"TileWidth": "256",
"TileHeight": "256",
"MatrixWidth": "16",
"MatrixHeight": "16",
"ranges": {
"cols": {
"min": "2",
"max": "5"
},
"rows": {
"min": "5",
"max": "6"
}
}
},
{
"ows:Identifier": "EPSG:900913:5",
"ScaleDenominator": "1.7471320748465404E7",
"TopLeftCorner": "-2.003750834E7 2.0037508E7",
"TileWidth": "256",
"TileHeight": "256",
"MatrixWidth": "32",
"MatrixHeight": "32",
"ranges": {
"cols": {
"min": "4",
"max": "10"
},
"rows": {
"min": "10",
"max": "13"
}
}
},
{
"ows:Identifier": "EPSG:900913:6",
"ScaleDenominator": "8735660.374232702",
"TopLeftCorner": "-2.003750834E7 2.0037508E7",
"TileWidth": "256",
"TileHeight": "256",
"MatrixWidth": "64",
"MatrixHeight": "64",
"ranges": {
"cols": {
"min": "9",
"max": "20"
},
"rows": {
"min": "21",
"max": "27"
}
}
},
{
"ows:Identifier": "EPSG:900913:7",
"ScaleDenominator": "4367830.187116351",
"TopLeftCorner": "-2.003750834E7 2.0037508E7",
"TileWidth": "256",
"TileHeight": "256",
"MatrixWidth": "128",
"MatrixHeight": "128",
"ranges": {
"cols": {
"min": "19",
"max": "40"
},
"rows": {
"min": "43",
"max": "54"
}
}
},
{
"ows:Identifier": "EPSG:900913:8",
"ScaleDenominator": "2183915.0935581755",
"TopLeftCorner": "-2.003750834E7 2.0037508E7",
"TileWidth": "256",
"TileHeight": "256",
"MatrixWidth": "256",
"MatrixHeight": "256",
"ranges": {
"cols": {
"min": "39",
"max": "80"
},
"rows": {
"min": "87",
"max": "109"
}
}
},
{
"ows:Identifier": "EPSG:900913:9",
"ScaleDenominator": "1091957.5467790877",
"TopLeftCorner": "-2.003750834E7 2.0037508E7",
"TileWidth": "256",
"TileHeight": "256",
"MatrixWidth": "512",
"MatrixHeight": "512",
"ranges": {
"cols": {
"min": "78",
"max": "161"
},
"rows": {
"min": "174",
"max": "219"
}
}
},
{
"ows:Identifier": "EPSG:900913:10",
"ScaleDenominator": "545978.7733895439",
"TopLeftCorner": "-2.003750834E7 2.0037508E7",
"TileWidth": "256",
"TileHeight": "256",
"MatrixWidth": "1024",
"MatrixHeight": "1024",
"ranges": {
"cols": {
"min": "156",
"max": "322"
},
"rows": {
"min": "349",
"max": "439"
}
}
},
{
"ows:Identifier": "EPSG:900913:11",
"ScaleDenominator": "272989.38669477194",
"TopLeftCorner": "-2.003750834E7 2.0037508E7",
"TileWidth": "256",
"TileHeight": "256",
"MatrixWidth": "2048",
"MatrixHeight": "2048",
"ranges": {
"cols": {
"min": "312",
"max": "644"
},
"rows": {
"min": "699",
"max": "878"
}
}
},
{
"ows:Identifier": "EPSG:900913:12",
"ScaleDenominator": "136494.69334738597",
"TopLeftCorner": "-2.003750834E7 2.0037508E7",
"TileWidth": "256",
"TileHeight": "256",
"MatrixWidth": "4096",
"MatrixHeight": "4096",
"ranges": {
"cols": {
"min": "625",
"max": "1289"
},
"rows": {
"min": "1398",
"max": "1756"
}
}
},
{
"ows:Identifier": "EPSG:900913:13",
"ScaleDenominator": "68247.34667369298",
"TopLeftCorner": "-2.003750834E7 2.0037508E7",
"TileWidth": "256",
"TileHeight": "256",
"MatrixWidth": "8192",
"MatrixHeight": "8192",
"ranges": {
"cols": {
"min": "1251",
"max": "2578"
},
"rows": {
"min": "2796",
"max": "3512"
}
}
},
{
"ows:Identifier": "EPSG:900913:14",
"ScaleDenominator": "34123.67333684649",
"TopLeftCorner": "-2.003750834E7 2.0037508E7",
"TileWidth": "256",
"TileHeight": "256",
"MatrixWidth": "16384",
"MatrixHeight": "16384",
"ranges": {
"cols": {
"min": "2502",
"max": "5157"
},
"rows": {
"min": "5592",
"max": "7024"
}
}
},
{
"ows:Identifier": "EPSG:900913:15",
"ScaleDenominator": "17061.836668423246",
"TopLeftCorner": "-2.003750834E7 2.0037508E7",
"TileWidth": "256",
"TileHeight": "256",
"MatrixWidth": "32768",
"MatrixHeight": "32768",
"ranges": {
"cols": {
"min": "5004",
"max": "10314"
},
"rows": {
"min": "11184",
"max": "14049"
}
}
},
{
"ows:Identifier": "EPSG:900913:16",
"ScaleDenominator": "8530.918334211623",
"TopLeftCorner": "-2.003750834E7 2.0037508E7",
"TileWidth": "256",
"TileHeight": "256",
"MatrixWidth": "65536",
"MatrixHeight": "65536",
"ranges": {
"cols": {
"min": "10008",
"max": "20629"
},
"rows": {
"min": "22368",
"max": "28098"
}
}
},
{
"ows:Identifier": "EPSG:900913:17",
"ScaleDenominator": "4265.4591671058115",
"TopLeftCorner": "-2.003750834E7 2.0037508E7",
"TileWidth": "256",
"TileHeight": "256",
"MatrixWidth": "131072",
"MatrixHeight": "131072",
"ranges": {
"cols": {
"min": "20017",
"max": "41258"
},
"rows": {
"min": "44737",
"max": "56197"
}
}
},
{
"ows:Identifier": "EPSG:900913:18",
"ScaleDenominator": "2132.7295835529058",
"TopLeftCorner": "-2.003750834E7 2.0037508E7",
"TileWidth": "256",
"TileHeight": "256",
"MatrixWidth": "262144",
"MatrixHeight": "262144",
"ranges": {
"cols": {
"min": "40035",
"max": "82516"
},
"rows": {
"min": "89475",
"max": "112394"
}
}
},
{
"ows:Identifier": "EPSG:900913:19",
"ScaleDenominator": "1066.3647917764529",
"TopLeftCorner": "-2.003750834E7 2.0037508E7",
"TileWidth": "256",
"TileHeight": "256",
"MatrixWidth": "524288",
"MatrixHeight": "524288",
"ranges": {
"cols": {
"min": "80070",
"max": "165032"
},
"rows": {
"min": "178950",
"max": "224788"
}
}
},
{
"ows:Identifier": "EPSG:900913:20",
"ScaleDenominator": "533.1823958882264",
"TopLeftCorner": "-2.003750834E7 2.0037508E7",
"TileWidth": "256",
"TileHeight": "256",
"MatrixWidth": "1048576",
"MatrixHeight": "1048576",
"ranges": {
"cols": {
"min": "160140",
"max": "330065"
},
"rows": {
"min": "357900",
"max": "449576"
}
}
},
{
"ows:Identifier": "EPSG:900913:21",
"ScaleDenominator": "266.5911979441132",
"TopLeftCorner": "-2.003750834E7 2.0037508E7",
"TileWidth": "256",
"TileHeight": "256",
"MatrixWidth": "2097152",
"MatrixHeight": "2097152",
"ranges": {
"cols": {
"min": "320280",
"max": "660130"
},
"rows": {
"min": "715801",
"max": "899153"
}
}
},
{
"ows:Identifier": "EPSG:900913:22",
"ScaleDenominator": "133.2955989720566",
"TopLeftCorner": "-2.003750834E7 2.0037508E7",
"TileWidth": "256",
"TileHeight": "256",
"MatrixWidth": "4194304",
"MatrixHeight": "4194304",
"ranges": {
"cols": {
"min": "640560",
"max": "1320261"
},
"rows": {
"min": "1431603",
"max": "1798306"
}
}
},
{
"ows:Identifier": "EPSG:900913:23",
"ScaleDenominator": "66.6477994860283",
"TopLeftCorner": "-2.003750834E7 2.0037508E7",
"TileWidth": "256",
"TileHeight": "256",
"MatrixWidth": "8388608",
"MatrixHeight": "8388608",
"ranges": {
"cols": {
"min": "1281121",
"max": "2640523"
},
"rows": {
"min": "2863206",
"max": "3596613"
}
}
},
{
"ows:Identifier": "EPSG:900913:24",
"ScaleDenominator": "33.32389974301415",
"TopLeftCorner": "-2.003750834E7 2.0037508E7",
"TileWidth": "256",
"TileHeight": "256",
"MatrixWidth": "16777216",
"MatrixHeight": "16777216",
"ranges": {
"cols": {
"min": "2562242",
"max": "5281046"
},
"rows": {
"min": "5726413",
"max": "7193226"
}
}
},
{
"ows:Identifier": "EPSG:900913:25",
"ScaleDenominator": "16.661949871507076",
"TopLeftCorner": "-2.003750834E7 2.0037508E7",
"TileWidth": "256",
"TileHeight": "256",
"MatrixWidth": "33554432",
"MatrixHeight": "33554432",
"ranges": {
"cols": {
"min": "5124485",
"max": "10562092"
},
"rows": {
"min": "11452826",
"max": "14386453"
}
}
},
{
"ows:Identifier": "EPSG:900913:26",
"ScaleDenominator": "8.330974935753538",
"TopLeftCorner": "-2.003750834E7 2.0037508E7",
"TileWidth": "256",
"TileHeight": "256",
"MatrixWidth": "67108864",
"MatrixHeight": "67108864",
"ranges": {
"cols": {
"min": "10248971",
"max": "21124185"
},
"rows": {
"min": "22905652",
"max": "28772907"
}
}
},
{
"ows:Identifier": "EPSG:900913:27",
"ScaleDenominator": "4.165487467876769",
"TopLeftCorner": "-2.003750834E7 2.0037508E7",
"TileWidth": "256",
"TileHeight": "256",
"MatrixWidth": "134217728",
"MatrixHeight": "134217728",
"ranges": {
"cols": {
"min": "20497942",
"max": "42248371"
},
"rows": {
"min": "45811304",
"max": "57545815"
}
}
},
{
"ows:Identifier": "EPSG:900913:28",
"ScaleDenominator": "2.0827437339383845",
"TopLeftCorner": "-2.003750834E7 2.0037508E7",
"TileWidth": "256",
"TileHeight": "256",
"MatrixWidth": "268435456",
"MatrixHeight": "268435456",
"ranges": {
"cols": {
"min": "40995885",
"max": "84496742"
},
"rows": {
"min": "91622609",
"max": "115091631"
}
}
},
{
"ows:Identifier": "EPSG:900913:29",
"ScaleDenominator": "1.0413718669691923",
"TopLeftCorner": "-2.003750834E7 2.0037508E7",
"TileWidth": "256",
"TileHeight": "256",
"MatrixWidth": "536870912",
"MatrixHeight": "536870912",
"ranges": {
"cols": {
"min": "81991770",
"max": "168993484"
},
"rows": {
"min": "183245218",
"max": "230183263"
}
}
},
{
"ows:Identifier": "EPSG:900913:30",
"ScaleDenominator": "0.5206859334845961",
"TopLeftCorner": "-2.003750834E7 2.0037508E7",
"TileWidth": "256",
"TileHeight": "256",
"MatrixWidth": "1073741824",
"MatrixHeight": "1073741824",
"ranges": {
"cols": {
"min": "163983541",
"max": "337986969"
},
"rows": {
"min": "366490436",
"max": "460366527"
}
}
}
]
}
}
}
}
},
"catalogServices": {},
"widgetsConfig": {},
"mapInfoConfiguration": {},
"dimensionData": {},
"timelineData": {}
}