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.
Solved! Go to Solution.
Hey Vani,
For this since there is a key within the WMTS you won't be able to put this in with the WTMS URL request, instead you will need to add the key as a Custom Parameter.
For example
 const wmtsLayer = new WMTSLayer({
                url: "https://api.os.uk/maps/raster/v1/wmts", 
                customParameters: { 
                  key: "xxxxxxxxxxxxxxxxxxxxxxxxxxx"
                },
                activeLayer: "OS Outdoor 27700", 
                tileMatrixSet: "BritishNationalGrid", 
                spatialReference: {
                    wkid: 27700 // EPSG:27700
                }
            });I would also check the URL you are using for the WMTS.
Hope that helps!
David
Hey Vani,
For this since there is a key within the WMTS you won't be able to put this in with the WTMS URL request, instead you will need to add the key as a Custom Parameter.
For example
 const wmtsLayer = new WMTSLayer({
                url: "https://api.os.uk/maps/raster/v1/wmts", 
                customParameters: { 
                  key: "xxxxxxxxxxxxxxxxxxxxxxxxxxx"
                },
                activeLayer: "OS Outdoor 27700", 
                tileMatrixSet: "BritishNationalGrid", 
                spatialReference: {
                    wkid: 27700 // EPSG:27700
                }
            });I would also check the URL you are using for the WMTS.
Hope that helps!
David
Hi - I have been having an awful time uploading a WMTS feed from OS onto Arcgis online. THANK you for this! Using the key as a separate attribute works!