Hi,
I am trying to implement ARC GIS maps with Ordnance survey base map by calling API using API key. I am calling the Ordnance survey API throw WMTSLayer function. However I get error as below:
4.31/:132 [esri.layers.WMTSLayer] #load() Failed to load layer (title: 'Layer', id:
Would like to know what is causing this error.
Below is the code I am testing.
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WMTS Layer with Ordnance Survey</title>
<style>
html, body, #viewDiv {
height: 100%;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div id="viewDiv"></div>
<script>
require([
"esri/Map",
"esri/views/MapView",
"esri/layers/WMTSLayer"
], function(Map, MapView, WMTSLayer) {
// Define the WMTS layer using the OS API
const wmtsLayer = new WMTSLayer({
activeLayer: "OS Outdoor 27700",
tileMatrixSet: "BritishNationalGrid",
spatialReference: {
wkid: 27700 // EPSG:27700
}
});
// Create a map and add the WMTS layer
const map = new Map({
basemap: {
baseLayers: [wmtsLayer]
}
});
// Create a MapView for the map
const view = new MapView({
container: "viewDiv", // Div element id
map: map,
center: [400000, 400000],
zoom: 10,
spatialReference: {
wkid: 27700
}
});
});
</script>
</body>
</html>