<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>WMTSLayer | Sample | ArcGIS Maps SDK for JavaScript</title>
<!-- Load the ArcGIS Maps SDK for JavaScript from CDN -->
<script type="module" src="https://js.arcgis.com/5.1/"></script>
<arcgis-map scale="4622333" center="-3.7038, 40.4168">
<arcgis-zoom slot="top-left"></arcgis-zoom>
<arcgis-basemap-toggle slot="bottom-left"></arcgis-basemap-toggle>
const [Basemap, WMTSLayer, Map] = await $arcgis.import([
"@arcgis/core/Basemap.js",
"@arcgis/core/layers/WMTSLayer.js",
// Get references to the component
const viewElement = document.querySelector("arcgis-map");
const basemapToggle = document.querySelector("arcgis-basemap-toggle");
// create basemaps from WMTS layer
const plainIGNBasemap = new Basemap({
url: "https://www.ign.es/wmts/ign-base",
activeLayer: { id: "IGNBase-gris", tileMatrixSetId: "GoogleMapsCompatible" },
copyright: `<a href="https://www.ign.es/" target="_blank">Instituto Geográfico Nacional</a>`,
"https://www.ign.es/wmts/ign-base?SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile&LAYER=IGNBase-gris&STYLE=default&FORMAT=image%2Fjpeg&TILEMATRIXSET=GoogleMapsCompatible&TILEMATRIX=6&TILEROW=24&TILECOL=31",
const orthoIGNBasemap = new Basemap({
url: "https://www.ign.es/wmts/mapa-raster",
activeLayer: { id: "MTN", tileMatrixSetId: "GoogleMapsCompatible" },
copyright: `<a href="https://www.ign.es/" target="_blank">Instituto Geográfico Nacional</a>`,
"https://www.ign.es/wmts/mapa-raster?SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile&LAYER=MTN&STYLE=default&FORMAT=image%2Fjpeg&TILEMATRIXSET=GoogleMapsCompatible&TILEMATRIX=6&TILEROW=24&TILECOL=31",
// create the map and set the basemap
viewElement.map = new Map({
basemap: plainIGNBasemap,
// set the next basemap in the Basemap Toggle
basemapToggle.nextBasemap = orthoIGNBasemap;