Select to view content in your preferred language

Add WMTS – OGC Web Service layer as a basemap

959
3
02-28-2022 03:05 AM
YashvitNaik
Occasional Contributor

I'm using ArcGIS Javascript API for a web application. I have a WMTS – OGC Web Service URL "https://svc.pictometry.com/Image/**********/wmts" which has multiple layers, so I have to add a layer from this service as a basemap to the map.

Referred the sample code from the ArcGIS API for javascript  sample=layers-wmts 

 

var customBasemapLayer = new this.esri.WMTSLayer({
        url: "https://svc.pictometry.com/Image/**********/wmts",
        activeLayer: {
        id: "******"
       }
});
this.map.add(customBasemapLayer);

 

the above code does not work for me. is there an alternate solution for this?

 

0 Kudos
3 Replies
BjornSvensson
Esri Regular Contributor

Your pseudo code looks correct - depending on the rest of your app.

Here's a working example for Pictometry: 

const layer = new WMTSLayer({
    url: "https://svc.pictometry.com/Image/26963D57-1E85-F308-2F17-9EB85101B1DC/wmts",
    copyright: "Pictometry",
    activeLayer: {
        id: "PICT-CASANL21-ghAPblT72Z"
    }
});


Example app - https://codepen.io/bsvensson/pen/RwjeXYE

0 Kudos
YashvitNaik
Occasional Contributor

hi @BjornSvensson thanks for the reply.


i tried your example app, but its throwing console errors

YashvitNaik_1-1662723538645.png

how to handle these errors?

0 Kudos
BjornSvensson
Esri Regular Contributor

@YashvitNaik - seems like the "PICT-CASANL21-ghAPblT72Z" no longer exists in that service you reference above.  If I change it to another layername like PICT-HIKAUA12-LIK2Cqnhav (that exists), and then zoom in a level or two, it seems to work fine.

0 Kudos