Hide Table of Contents
View WMTS layer sample in sandbox
WMTS layer

Description

At version 2.4 of the ArcGIS API for JavaScript a class esri.layers.WMTSLayer was added to the API. This sample shows how to use the WMTSLayer class to add an OGC Web Map Tiled Service layer to the map. The default behavior of a WMTSLayer is to execute a WMTS GetCapabilities request, which requires using a proxy page.

View the WMTS Layer-Resource Info sample for an example that shows how to specify the resource info so a proxy is not required.

Code

<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  
  <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
  <title>Add WMTS Layer</title>

  <link rel="stylesheet" href="https://js.arcgis.com/3.46/esri/css/esri.css">
  <style>
  html,
  body,
  #map {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
  }

  #citationInfo {
    position: absolute;
    font-weight: bold;
    font-size: 12pt;
    left: 10px;
    bottom: 10px;
    z-Index: 999;
  }
  </style>

  <script src="https://js.arcgis.com/3.46/"></script>
  <script>
    require([
      "esri/map", "esri/layers/WMTSLayer", "esri/layers/WMTSLayerInfo",
      "esri/config",
      "dojo/domReady!"
    ], function(
      Map, WMTSLayer, WMTSLayerInfo,
      esriConfig
    ) {
      var map = new Map("map", {
        center: [86.9, 28],//27.988056, 86.925
        zoom: 3
      });

      var layerInfo = new WMTSLayerInfo({
        identifier: "SRTM_Color_Index",
        tileMatrixSet: "31.25m",
        format: "png"
      });
      var options = {
        layerInfo: layerInfo
      };
      var wmtsLayer = new WMTSLayer("https://gibs.earthdata.nasa.gov/wmts/epsg4326/best", options);
      map.addLayer(wmtsLayer);
    });
  </script>
</head>

<body>
  <div id="map">
    <div id="citationInfo">
      <a target='_top' href='https://www.earthdata.nasa.gov'>Earthdata</a> by
      <a target='_top' href='https://www.nasa.gov'>NASA</a>
    </div>
  </div>
</body>
</html>
 
          
Show Modal