<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Zoom to layer option in MapLayer in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zoom-to-layer-option-in-maplayer/m-p/595642#M55820</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please see my code: and please see the attached image, i want to get the zoom to option for each layer &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="LTFE1.PNG" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/194901_LTFE1.PNG" style="width: 620px; height: 258px;" /&gt;&lt;/P&gt;&lt;P&gt;var map, operational;&lt;/P&gt;&lt;P&gt;require(["dojo/_base/connect",&lt;/P&gt;&lt;P&gt;"dojo/dom", "dojo/parser", "dojo/on", "dojo/_base/Color",&lt;/P&gt;&lt;P&gt;"esri/IdentityManager",&lt;/P&gt;&lt;P&gt;"esri/map",&lt;/P&gt;&lt;P&gt;"esri/InfoTemplate",&lt;/P&gt;&lt;P&gt;"esri/geometry/Extent",&lt;/P&gt;&lt;P&gt;"esri/dijit/Measurement",&lt;/P&gt;&lt;P&gt;"esri/layers/FeatureLayer",&lt;/P&gt;&lt;P&gt;"esri/layers/ArcGISTiledMapServiceLayer",&lt;/P&gt;&lt;P&gt;"esri/layers/ArcGISDynamicMapServiceLayer",&lt;/P&gt;&lt;P&gt;"esri/symbols/SimpleFillSymbol",&lt;/P&gt;&lt;P&gt;"esri/symbols/SimpleLineSymbol",&lt;/P&gt;&lt;P&gt;"esri/renderers/ClassBreaksRenderer",&lt;/P&gt;&lt;P&gt;"agsjs/dijit/TOC",&lt;/P&gt;&lt;P&gt;"esri/dijit/BasemapGallery",&lt;/P&gt;&lt;P&gt;"esri/arcgis/utils",&lt;/P&gt;&lt;P&gt;"esri/tasks/IdentifyTask",&lt;/P&gt;&lt;P&gt;"esri/tasks/IdentifyParameters",&lt;/P&gt;&lt;P&gt;"esri/tasks/QueryTask",&lt;/P&gt;&lt;P&gt;"esri/dijit/Popup",&lt;/P&gt;&lt;P&gt;"esri/dijit/HomeButton",&lt;/P&gt;&lt;P&gt;"esri/dijit/Geocoder",&lt;/P&gt;&lt;P&gt;"dojo/_base/array",&lt;/P&gt;&lt;P&gt;"esri/Color",&lt;/P&gt;&lt;P&gt;"dojo/dom-construct",&lt;/P&gt;&lt;P&gt;"esri/dijit/Scalebar",&lt;/P&gt;&lt;P&gt;"dijit/layout/BorderContainer",&lt;/P&gt;&lt;P&gt;"dijit/layout/ContentPane",&lt;/P&gt;&lt;P&gt;"dijit/TitlePane",&lt;/P&gt;&lt;P&gt;"dojo/fx", "dojo/domReady!"],&lt;/P&gt;&lt;P&gt;function init(connect, dom, parser, on, Color, IdentityManager, Map, InfoTemplate, Extent, Measurement, FeatureLayer, ArcGISTiledMapServiceLayer,&lt;/P&gt;&lt;P&gt;ArcGISDynamicMapServiceLayer, SimpleFillSymbol, SimpleLineSymbol, ClassBreaksRenderer, TOC, BasemapGallery, arcgisUtils,&lt;/P&gt;&lt;P&gt;IdentifyTask, IdentifyParameters, QueryTask, Popup, HomeButton, Geocoder, arrayUtils, Color, domConstruct) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; parser.parse();&lt;/P&gt;&lt;P&gt;&amp;nbsp; map = new Map("mapDiv", {&lt;/P&gt;&lt;P&gt;&amp;nbsp; center: [11.8802278, 51.3902768 ] , &lt;/P&gt;&lt;P&gt;&amp;nbsp; zoom: 17,&lt;/P&gt;&lt;P&gt;&amp;nbsp; basemap: "satellite",&lt;/P&gt;&lt;P&gt;&amp;nbsp; //slider: false&lt;/P&gt;&lt;P&gt;&amp;nbsp; });&lt;/P&gt;&lt;P&gt;&amp;nbsp; var geocoder = new Geocoder({&lt;/P&gt;&lt;P&gt;&amp;nbsp; map: map&lt;/P&gt;&lt;P&gt;&amp;nbsp; }, "search");&lt;/P&gt;&lt;P&gt;&amp;nbsp; geocoder.startup();&lt;/P&gt;&lt;P&gt;&amp;nbsp; var basemapGallery = new BasemapGallery({&lt;/P&gt;&lt;P&gt;&amp;nbsp; showArcGISBasemaps: true,&lt;/P&gt;&lt;P&gt;&amp;nbsp; map: map&lt;/P&gt;&lt;P&gt;&amp;nbsp; }, "basemapGallery");&lt;/P&gt;&lt;P&gt;&amp;nbsp; basemapGallery.startup();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; basemapGallery.on("error", function (msg) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; console.log("basemap gallery error: ", msg);&lt;/P&gt;&lt;P&gt;&amp;nbsp; });&lt;/P&gt;&lt;P&gt;&amp;nbsp; var scalebar = new esri.dijit.Scalebar({ map: map, scalebarUnit: "dual" });&lt;/P&gt;&lt;P&gt;&amp;nbsp; var home = new HomeButton({&lt;/P&gt;&lt;P&gt;&amp;nbsp; map: map&lt;/P&gt;&lt;P&gt;&amp;nbsp; }, "HomeButton");&lt;/P&gt;&lt;P&gt;&amp;nbsp; home.startup();&lt;/P&gt;&lt;P&gt;&amp;nbsp; var measurement = new Measurement({&lt;/P&gt;&lt;P&gt;&amp;nbsp; map: map&lt;/P&gt;&lt;P&gt;&amp;nbsp; }, dom.byId("measurementDiv"));&lt;/P&gt;&lt;P&gt;&amp;nbsp; measurement.startup();&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; operational = "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2F192.168.224.13%2Farcgis%2Frest%2Fservices%2FLTFE_Sites_DEUTSCHLAND%2FMapServer" rel="nofollow" target="_blank"&gt;https://192.168.224.13/arcgis/rest/services/LTFE_Sites_DEUTSCHLAND/MapServer&lt;/A&gt;&lt;SPAN&gt;";&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var operationalLayer = new esri.layers.ArcGISDynamicMapServiceLayer(operational, { id: 'Dynamic' }&lt;/P&gt;&lt;P&gt;&amp;nbsp; );&lt;/P&gt;&lt;P&gt;&amp;nbsp; map.addLayers([operationalLayer]);&lt;/P&gt;&lt;P&gt;&amp;nbsp; // Add Table of Contents Start&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; map.on('layers-add-result', function (evt) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; try {&lt;/P&gt;&lt;P&gt;&amp;nbsp; var toc = new TOC({&lt;/P&gt;&lt;P&gt;&amp;nbsp; map: map,&lt;/P&gt;&lt;P&gt;&amp;nbsp; layerInfos: [{&lt;/P&gt;&lt;P&gt;&amp;nbsp; layer: operationalLayer,&lt;/P&gt;&lt;P&gt;&amp;nbsp; title: "LTFE Sites"&lt;/P&gt;&lt;P&gt;&amp;nbsp; }]&lt;/P&gt;&lt;P&gt;&amp;nbsp; }, "legendDiv");&lt;/P&gt;&lt;P&gt;&amp;nbsp; toc.startup();&lt;/P&gt;&lt;P&gt;&amp;nbsp; toc.on("load", function () {&lt;/P&gt;&lt;P&gt;&amp;nbsp; console.log("TOC loaded");&lt;/P&gt;&lt;P&gt;&amp;nbsp; });&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; catch (e) { console.error(e.message); }&lt;/P&gt;&lt;P&gt;&amp;nbsp; });&lt;/P&gt;&lt;P&gt;&amp;nbsp; functionMode = true;&lt;/P&gt;&lt;P&gt;&amp;nbsp; on(map, "click", function (evt) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; if (functionMode == true) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; executeIdentifyTask(evt);&lt;/P&gt;&lt;P&gt;&amp;nbsp; } else {&lt;/P&gt;&lt;P&gt;&amp;nbsp; return;&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; });&lt;/P&gt;&lt;P&gt;&amp;nbsp; identifyTask = new IdentifyTask(operational);&lt;/P&gt;&lt;P&gt;&amp;nbsp; identifyParams = new IdentifyParameters();&lt;/P&gt;&lt;P&gt;&amp;nbsp; identifyParams.tolerance = 3;&lt;/P&gt;&lt;P&gt;&amp;nbsp; identifyParams.returnGeometry = true;&lt;/P&gt;&lt;P&gt;&amp;nbsp; identifyParams.layerIds = operationalLayer.visibleLayers;&lt;/P&gt;&lt;P&gt;&amp;nbsp; identifyParams.layerOption = IdentifyParameters.LAYER_OPTION_ALL;&lt;/P&gt;&lt;P&gt;&amp;nbsp; identifyParams.width = map.width;&lt;/P&gt;&lt;P&gt;&amp;nbsp; identifyParams.height = map.height;&lt;/P&gt;&lt;P&gt;&amp;nbsp; function executeIdentifyTask(evt) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; identifyParams.geometry = evt.mapPoint;&lt;/P&gt;&lt;P&gt;&amp;nbsp; identifyParams.mapExtent = map.extent;&lt;/P&gt;&lt;P&gt;&amp;nbsp; identifyParams.layerIds = operationalLayer.visibleLayers;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var deferred = identifyTask.execute(identifyParams);&lt;/P&gt;&lt;P&gt;&amp;nbsp; deferred.addCallback(function (response) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; return dojo.map(response, function (result) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; var feature = result.feature;&lt;/P&gt;&lt;P&gt;&amp;nbsp; feature.attributes.layerName = result.layerName;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var template = new InfoTemplate("", "${*}");&lt;/P&gt;&lt;P&gt;&amp;nbsp; feature.setInfoTemplate(template);&lt;/P&gt;&lt;P&gt;&amp;nbsp; return feature;&lt;/P&gt;&lt;P&gt;&amp;nbsp; });&lt;/P&gt;&lt;P&gt;&amp;nbsp; });&lt;/P&gt;&lt;P&gt;&amp;nbsp; map.infoWindow.setFeatures([deferred]);&lt;/P&gt;&lt;P&gt;&amp;nbsp; map.infoWindow.show(evt.mapPoint);&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;});&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 15 Apr 2016 13:23:36 GMT</pubDate>
    <dc:creator>Muqit_Zoarder</dc:creator>
    <dc:date>2016-04-15T13:23:36Z</dc:date>
    <item>
      <title>Zoom to layer option in MapLayer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zoom-to-layer-option-in-maplayer/m-p/595640#M55818</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear all, i have 25 layers in a MapService which are from different parts of a country. I have created a ArcGIS Javascript API application to view the all 25 map layer together and also the feature informtation by click event. Now the problem is i want to add "zoom to layer" option in each layer. Because the whole dataset is belogns to a country scale and i cannot even see all te layers now in the map extent. So I want to add a option in each layer , like the arcGIS online, if i click on zoom to layer then the particular layer extent will come. Please help me out from this problem. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanking you &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Apr 2016 09:44:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zoom-to-layer-option-in-maplayer/m-p/595640#M55818</guid>
      <dc:creator>Muqit_Zoarder</dc:creator>
      <dc:date>2016-04-15T09:44:55Z</dc:date>
    </item>
    <item>
      <title>Re: Zoom to layer option in MapLayer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zoom-to-layer-option-in-maplayer/m-p/595641#M55819</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can retrieve a features extent by using the Feature Layer's queryExtent method. This will return the full extent of the feature layer, which you can then use to set the extent of the map using its setExtent method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your code would look something like this:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;function zoomToLayer(featureLayer) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; query = new Query();
&amp;nbsp;&amp;nbsp;&amp;nbsp; query.where = featureLayer.getDefinitionExpression() || "1=1";
&amp;nbsp;&amp;nbsp;&amp;nbsp; featureLayer.queryExtent(query).then(
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; function(result) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.setExtent(result.extent);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; },
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; function(error) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.error("Failed to get query extent", error);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; )
}&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 01:34:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zoom-to-layer-option-in-maplayer/m-p/595641#M55819</guid>
      <dc:creator>DavidBlanchard</dc:creator>
      <dc:date>2021-12-12T01:34:24Z</dc:date>
    </item>
    <item>
      <title>Re: Zoom to layer option in MapLayer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zoom-to-layer-option-in-maplayer/m-p/595642#M55820</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please see my code: and please see the attached image, i want to get the zoom to option for each layer &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="LTFE1.PNG" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/194901_LTFE1.PNG" style="width: 620px; height: 258px;" /&gt;&lt;/P&gt;&lt;P&gt;var map, operational;&lt;/P&gt;&lt;P&gt;require(["dojo/_base/connect",&lt;/P&gt;&lt;P&gt;"dojo/dom", "dojo/parser", "dojo/on", "dojo/_base/Color",&lt;/P&gt;&lt;P&gt;"esri/IdentityManager",&lt;/P&gt;&lt;P&gt;"esri/map",&lt;/P&gt;&lt;P&gt;"esri/InfoTemplate",&lt;/P&gt;&lt;P&gt;"esri/geometry/Extent",&lt;/P&gt;&lt;P&gt;"esri/dijit/Measurement",&lt;/P&gt;&lt;P&gt;"esri/layers/FeatureLayer",&lt;/P&gt;&lt;P&gt;"esri/layers/ArcGISTiledMapServiceLayer",&lt;/P&gt;&lt;P&gt;"esri/layers/ArcGISDynamicMapServiceLayer",&lt;/P&gt;&lt;P&gt;"esri/symbols/SimpleFillSymbol",&lt;/P&gt;&lt;P&gt;"esri/symbols/SimpleLineSymbol",&lt;/P&gt;&lt;P&gt;"esri/renderers/ClassBreaksRenderer",&lt;/P&gt;&lt;P&gt;"agsjs/dijit/TOC",&lt;/P&gt;&lt;P&gt;"esri/dijit/BasemapGallery",&lt;/P&gt;&lt;P&gt;"esri/arcgis/utils",&lt;/P&gt;&lt;P&gt;"esri/tasks/IdentifyTask",&lt;/P&gt;&lt;P&gt;"esri/tasks/IdentifyParameters",&lt;/P&gt;&lt;P&gt;"esri/tasks/QueryTask",&lt;/P&gt;&lt;P&gt;"esri/dijit/Popup",&lt;/P&gt;&lt;P&gt;"esri/dijit/HomeButton",&lt;/P&gt;&lt;P&gt;"esri/dijit/Geocoder",&lt;/P&gt;&lt;P&gt;"dojo/_base/array",&lt;/P&gt;&lt;P&gt;"esri/Color",&lt;/P&gt;&lt;P&gt;"dojo/dom-construct",&lt;/P&gt;&lt;P&gt;"esri/dijit/Scalebar",&lt;/P&gt;&lt;P&gt;"dijit/layout/BorderContainer",&lt;/P&gt;&lt;P&gt;"dijit/layout/ContentPane",&lt;/P&gt;&lt;P&gt;"dijit/TitlePane",&lt;/P&gt;&lt;P&gt;"dojo/fx", "dojo/domReady!"],&lt;/P&gt;&lt;P&gt;function init(connect, dom, parser, on, Color, IdentityManager, Map, InfoTemplate, Extent, Measurement, FeatureLayer, ArcGISTiledMapServiceLayer,&lt;/P&gt;&lt;P&gt;ArcGISDynamicMapServiceLayer, SimpleFillSymbol, SimpleLineSymbol, ClassBreaksRenderer, TOC, BasemapGallery, arcgisUtils,&lt;/P&gt;&lt;P&gt;IdentifyTask, IdentifyParameters, QueryTask, Popup, HomeButton, Geocoder, arrayUtils, Color, domConstruct) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; parser.parse();&lt;/P&gt;&lt;P&gt;&amp;nbsp; map = new Map("mapDiv", {&lt;/P&gt;&lt;P&gt;&amp;nbsp; center: [11.8802278, 51.3902768 ] , &lt;/P&gt;&lt;P&gt;&amp;nbsp; zoom: 17,&lt;/P&gt;&lt;P&gt;&amp;nbsp; basemap: "satellite",&lt;/P&gt;&lt;P&gt;&amp;nbsp; //slider: false&lt;/P&gt;&lt;P&gt;&amp;nbsp; });&lt;/P&gt;&lt;P&gt;&amp;nbsp; var geocoder = new Geocoder({&lt;/P&gt;&lt;P&gt;&amp;nbsp; map: map&lt;/P&gt;&lt;P&gt;&amp;nbsp; }, "search");&lt;/P&gt;&lt;P&gt;&amp;nbsp; geocoder.startup();&lt;/P&gt;&lt;P&gt;&amp;nbsp; var basemapGallery = new BasemapGallery({&lt;/P&gt;&lt;P&gt;&amp;nbsp; showArcGISBasemaps: true,&lt;/P&gt;&lt;P&gt;&amp;nbsp; map: map&lt;/P&gt;&lt;P&gt;&amp;nbsp; }, "basemapGallery");&lt;/P&gt;&lt;P&gt;&amp;nbsp; basemapGallery.startup();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; basemapGallery.on("error", function (msg) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; console.log("basemap gallery error: ", msg);&lt;/P&gt;&lt;P&gt;&amp;nbsp; });&lt;/P&gt;&lt;P&gt;&amp;nbsp; var scalebar = new esri.dijit.Scalebar({ map: map, scalebarUnit: "dual" });&lt;/P&gt;&lt;P&gt;&amp;nbsp; var home = new HomeButton({&lt;/P&gt;&lt;P&gt;&amp;nbsp; map: map&lt;/P&gt;&lt;P&gt;&amp;nbsp; }, "HomeButton");&lt;/P&gt;&lt;P&gt;&amp;nbsp; home.startup();&lt;/P&gt;&lt;P&gt;&amp;nbsp; var measurement = new Measurement({&lt;/P&gt;&lt;P&gt;&amp;nbsp; map: map&lt;/P&gt;&lt;P&gt;&amp;nbsp; }, dom.byId("measurementDiv"));&lt;/P&gt;&lt;P&gt;&amp;nbsp; measurement.startup();&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; operational = "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2F192.168.224.13%2Farcgis%2Frest%2Fservices%2FLTFE_Sites_DEUTSCHLAND%2FMapServer" rel="nofollow" target="_blank"&gt;https://192.168.224.13/arcgis/rest/services/LTFE_Sites_DEUTSCHLAND/MapServer&lt;/A&gt;&lt;SPAN&gt;";&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var operationalLayer = new esri.layers.ArcGISDynamicMapServiceLayer(operational, { id: 'Dynamic' }&lt;/P&gt;&lt;P&gt;&amp;nbsp; );&lt;/P&gt;&lt;P&gt;&amp;nbsp; map.addLayers([operationalLayer]);&lt;/P&gt;&lt;P&gt;&amp;nbsp; // Add Table of Contents Start&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; map.on('layers-add-result', function (evt) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; try {&lt;/P&gt;&lt;P&gt;&amp;nbsp; var toc = new TOC({&lt;/P&gt;&lt;P&gt;&amp;nbsp; map: map,&lt;/P&gt;&lt;P&gt;&amp;nbsp; layerInfos: [{&lt;/P&gt;&lt;P&gt;&amp;nbsp; layer: operationalLayer,&lt;/P&gt;&lt;P&gt;&amp;nbsp; title: "LTFE Sites"&lt;/P&gt;&lt;P&gt;&amp;nbsp; }]&lt;/P&gt;&lt;P&gt;&amp;nbsp; }, "legendDiv");&lt;/P&gt;&lt;P&gt;&amp;nbsp; toc.startup();&lt;/P&gt;&lt;P&gt;&amp;nbsp; toc.on("load", function () {&lt;/P&gt;&lt;P&gt;&amp;nbsp; console.log("TOC loaded");&lt;/P&gt;&lt;P&gt;&amp;nbsp; });&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; catch (e) { console.error(e.message); }&lt;/P&gt;&lt;P&gt;&amp;nbsp; });&lt;/P&gt;&lt;P&gt;&amp;nbsp; functionMode = true;&lt;/P&gt;&lt;P&gt;&amp;nbsp; on(map, "click", function (evt) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; if (functionMode == true) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; executeIdentifyTask(evt);&lt;/P&gt;&lt;P&gt;&amp;nbsp; } else {&lt;/P&gt;&lt;P&gt;&amp;nbsp; return;&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; });&lt;/P&gt;&lt;P&gt;&amp;nbsp; identifyTask = new IdentifyTask(operational);&lt;/P&gt;&lt;P&gt;&amp;nbsp; identifyParams = new IdentifyParameters();&lt;/P&gt;&lt;P&gt;&amp;nbsp; identifyParams.tolerance = 3;&lt;/P&gt;&lt;P&gt;&amp;nbsp; identifyParams.returnGeometry = true;&lt;/P&gt;&lt;P&gt;&amp;nbsp; identifyParams.layerIds = operationalLayer.visibleLayers;&lt;/P&gt;&lt;P&gt;&amp;nbsp; identifyParams.layerOption = IdentifyParameters.LAYER_OPTION_ALL;&lt;/P&gt;&lt;P&gt;&amp;nbsp; identifyParams.width = map.width;&lt;/P&gt;&lt;P&gt;&amp;nbsp; identifyParams.height = map.height;&lt;/P&gt;&lt;P&gt;&amp;nbsp; function executeIdentifyTask(evt) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; identifyParams.geometry = evt.mapPoint;&lt;/P&gt;&lt;P&gt;&amp;nbsp; identifyParams.mapExtent = map.extent;&lt;/P&gt;&lt;P&gt;&amp;nbsp; identifyParams.layerIds = operationalLayer.visibleLayers;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var deferred = identifyTask.execute(identifyParams);&lt;/P&gt;&lt;P&gt;&amp;nbsp; deferred.addCallback(function (response) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; return dojo.map(response, function (result) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; var feature = result.feature;&lt;/P&gt;&lt;P&gt;&amp;nbsp; feature.attributes.layerName = result.layerName;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var template = new InfoTemplate("", "${*}");&lt;/P&gt;&lt;P&gt;&amp;nbsp; feature.setInfoTemplate(template);&lt;/P&gt;&lt;P&gt;&amp;nbsp; return feature;&lt;/P&gt;&lt;P&gt;&amp;nbsp; });&lt;/P&gt;&lt;P&gt;&amp;nbsp; });&lt;/P&gt;&lt;P&gt;&amp;nbsp; map.infoWindow.setFeatures([deferred]);&lt;/P&gt;&lt;P&gt;&amp;nbsp; map.infoWindow.show(evt.mapPoint);&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;});&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Apr 2016 13:23:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zoom-to-layer-option-in-maplayer/m-p/595642#M55820</guid>
      <dc:creator>Muqit_Zoarder</dc:creator>
      <dc:date>2016-04-15T13:23:36Z</dc:date>
    </item>
  </channel>
</rss>

