Select to view content in your preferred language

ArcGISTiledMapServiceLayer and WMTSLayer

3919
3
02-16-2015 05:31 AM
UrsRichard
Emerging Contributor

I'm using an ArcGISTiledMapServiceLayer as baselayer in a ESRI API for JavaScript project. As a second layer I'm trying to add a WMTS Layer. Unfortunately the WMTS Layer will not be shown. If I use the same WMTS layer as baselayer it works fine. The ArcGISTiledMapServiceLayer and the WMTS Layer uses the same spatial reference but have different LODs/TileMatrixSets. Is it possible to use a WMTS Layer together with a ArcGISTiledMapServiceLayer?

0 Kudos
3 Replies
TimWitt2
MVP Alum

Hey Urs,

what code are you using to add the WMTS layer?

Tim

0 Kudos
UrsRichard
Emerging Contributor

<script>

            var map;

          

            require(["esri/map", "esri/layers/WMTSLayer", "dojo/domReady!"], function(Map, WMTSLayer) {

                var extent = new esri.geometry.Extent(595171.7678435356, 200875.0317500635, 702328.2321564644, 294124.9682499365, new esri.SpatialReference({

                    "wkid": 21781

                }));

                map = new Map("map", {

                    //basemap: "topo",

                    //center: [7.537513, 47.208331], // longitude, latitude

                    // zoom: 13

                    extent: extent

                });

                esri.config.defaults.io.proxyUrl = "./proxy/PHP/proxy.php";

                // esriConfig.defaults.io.alwaysUseProxy = false;

                var layerinfo = new esri.layers.WMTSLayerInfo({

                    identifier: 'ch.swisstopo.pixelkarte-grau'

                });

                var options = {

                    id: 'swisstopo',

                    layerInfo: layerinfo

                };

                var wmts = new WMTSLayer("http://wmts.geo.admin.ch", options);

              

                var luftbild = new esri.layers.ArcGISTiledMapServiceLayer("https://quality.ag.ch/geoportal/rest/services/base_ortho2013_full/MapServer", {

                    id: 'luftbild'

                });

                var giselan = new esri.layers.ArcGISDynamicMapServiceLayer("https://www.ag.ch/geoportal/rest/services/lwag_giselan_app/MapServer", {

                    id: 'giselan'

                });

              

                map.on("load", function(map){

                    //use as breakpoint for layer loaded

                    var i = 10;

              

                });

              

                map.addLayer(luftbild);

                map.addLayer(wmts);

                // map.addLayer(giselan);

              

              

            });

        </script>

0 Kudos
YueWu1
by Esri Regular Contributor
Esri Regular Contributor

Hi Urs,

Here is an sample to show you how to load WMTSLayer and ArcGISTiledMapServiceLayer together on mapview.

JS Bin - Collaborative JavaScript Debugging 

In order to “bypass” proxy to execute a WMTSLayerGetCapbilities request, we need to

  1. Redefine the WMTSLayer’s Tileinfo based on your ArcGISTiledMapServiceLayer LOD, dpi an so on…
  2. Create a new WMTSLayer resourceInfo
Hope this can help.
0 Kudos