Hi,
I'm trying to add a WMTS layer as Basemap, but can not.
Is this possible?
My code is as follows, and I get error request:
var tileInfo = new TileInfo({
"dpi": "96",
"format": "image/jpeg",
"compressionQuality": 0,
"spatialReference": {"wkid": "25830"},
"rows": 256,
"cols": 256,
"origin": {
"x": 400000,
"y": 4600000
},
"lods":[{"level": "EPSG:25830:0","scale": 2200000,"resolution": 582.08449750232842},
{"level": "EPSG:25830:1","scale": 1600000,"resolution": 423.33418000169337},
{"level": "EPSG:25830:2","scale": 1000000,"resolution": 264.58386250105838},
{"level": "EPSG:25830:3","scale": 800000,"resolution": 211.66709000084668},
{"level": "EPSG:25830:4","scale": 600000,"resolution": 158.75031750063502},
{"level": "EPSG:25830:5","scale": 500000,"resolution": 132.29193125052919},
{"level": "EPSG:25830:6","scale": 400000,"resolution": 105.83354500042334},
{"level": "EPSG:25830:7","scale": 300000,"resolution": 79.375158750317510},
{"level": "EPSG:25830:8","scale": 250000,"resolution": 66.145965625264594},
{"level": "EPSG:25830:9","scale": 200000,"resolution": 52.916772500211671},
{"level": "EPSG:25830:10","scale": 150000,"resolution": 39.687579375158755},
{"level": "EPSG:25830:11","scale": 125000,"resolution": 33.072982812632297},
{"level": "EPSG:25830:12","scale": 100000,"resolution": 26.458386250105836},
{"level": "EPSG:25830:13","scale": 90000,"resolution": 23.812547625095252},
{"level": "EPSG:25830:14","scale": 80000,"resolution": 21.166709000084669},
{"level": "EPSG:25830:15","scale": 70000,"resolution": 18.520870375074086},
{"level": "EPSG:25830:16","scale": 60000,"resolution": 15.875031750063501},
{"level": "EPSG:25830:17","scale": 50000,"resolution": 13.229193125052918},
{"level": "EPSG:25830:18","scale": 40000,"resolution": 10.583354500042335},
{"level": "EPSG:25830:19","scale": 30000,"resolution": 7.9375158750317505},
{"level": "EPSG:25830:20","scale": 25000,"resolution": 6.6145965625264589},
{"level": "EPSG:25830:21","scale": 20000,"resolution": 5.2916772500211673},
{"level": "EPSG:25830:22","scale": 15000,"resolution": 3.9687579375158752},
{"level": "EPSG:25830:23","scale": 12500,"resolution": 3.3072982812632294},
{"level": "EPSG:25830:24","scale": 10000,"resolution": 2.6458386250105836},
{"level": "EPSG:25830:25","scale": 7500,"resolution": 1.9843789687579376},
{"level": "EPSG:25830:26","scale": 5000,"resolution": 1.322919312505290},
{"level": "EPSG:25830:27","scale": 3000,"resolution": 0.793751587503175},
{"level": "EPSG:25830:28","scale": 2000,"resolution": 0.529167725002117},
{"level": "EPSG:25830:29","scale": 1000,"resolution": 0.264583862501058},
{"level": "EPSG:25830:30","scale": 500,"resolution": 0.132291931250529}]
});
var CapaBase = new BasemapLayer({
url: servidor + "geowebcache/service/wmts",
type: "WebTiledLayer",
tileInfo: tileInfo});
var capaBaseOrto = new Basemap({layers: [CapaBase], id: "Ortofoto", title: "Ortofoto", thumbnailUrl:"images/base_ortofoto.jpg"});
basemaps.push(capaBaseOrto);
...
var basemapGallery = new BasemapGallery({
showArcGISBasemaps: false,
basemaps: basemaps,
map: map
}, "basemapGallery");
basemapGallery.startup();
Thanks!
Pau,
you could always load your map without a basemap which will make your wmts layer the "basemap"
just comment out the ESRI basemap.
Tim
Thanks Tim for the response,
I would like to load multiple layers as basemap, and switch between them using the BasemapGallery.
It was to avoid doing it manually.
Thanks!
Pau,
what is the error you get? Can you also post the code where you define basemaps?
Tim
The error is in the request because it is not built well. My request is:
http://cartoplora.cma.gva.es/geowebcache/service/wmts?SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile&LAY..." + level + "&TILEROW=" + row + "&TILECOL=" + col
But when I click on basemap thumbnail basemap request is:
http://cartoplora.cma.gva.es/geowebcache/service/wmts
The request is like WMS, without parameters, and only one request.
I do not know where to define parameters such as name layer ("Ortofoto_ICV" or "MDT_LIDAR"), Tilematrixset,... I think it is not possible.
The code is in my first post. I define a array "basemaps" , where I add the Basemap Layers (basemaps.push(...)).
Thanks in advance.