<?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: Zooming into layers from a dynamic map service in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zooming-into-layers-from-a-dynamic-map-service/m-p/114117#M10630</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think you need something like this......&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; GISLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://service.ncddc.noaa.gov/arcgis/rest/services/OceanExploration/regatlasSATL/MapServer", { "imageParameters": imageParameters });
&amp;nbsp;&amp;nbsp;&amp;nbsp; map.addLayer(GISLayer);
&amp;nbsp;&amp;nbsp; dojo.connect(GISLayer, 'onLoad', function(mapLayout) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.setExtent(GISLayer.fullExtent);
&amp;nbsp;&amp;nbsp;&amp;nbsp; });

&amp;nbsp;&amp;nbsp;&amp;nbsp; //1. set map extent example
&amp;nbsp;&amp;nbsp;&amp;nbsp; // map.setExtent(map.extent);&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 06:46:27 GMT</pubDate>
    <dc:creator>VinayBansal</dc:creator>
    <dc:date>2021-12-11T06:46:27Z</dc:date>
    <item>
      <title>Zooming into layers from a dynamic map service</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zooming-into-layers-from-a-dynamic-map-service/m-p/114110#M10623</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is there any way to zoom into some of the layers of a dynamic map service?&amp;nbsp; I'm doing this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;var imageParameters = new esri.layers.ImageParameters(); imageParameters.layerIds = [2,3,4]; imageParameters.layerOption = esri.layers.ImageParameters.LAYER_OPTION_SHOW; GISLayer = new esri.layers.ArcGISDynamicMapServiceLayer(mapServiceURL,{"imageParameters":imageParameters}); map.addLayer(GISLayer);&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;I get the layers I want to see on the map but I would like to have map zoom into the extent of these layers. Is this possible?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;TIA&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Sep 2013 14:08:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zooming-into-layers-from-a-dynamic-map-service/m-p/114110#M10623</guid>
      <dc:creator>BetsySchenck-Gardner</dc:creator>
      <dc:date>2013-09-09T14:08:08Z</dc:date>
    </item>
    <item>
      <title>Re: Zooming into layers from a dynamic map service</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zooming-into-layers-from-a-dynamic-map-service/m-p/114111#M10624</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Here is a sample code to zoom to one layer's extent. If you need to zoom to the extent of multiple layers, you will need to get the extent of each layer using esri.request, and use geometryService.union to get the extent to cover all the layers, and zoom the map to it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;esri.request({
&amp;nbsp;&amp;nbsp;&amp;nbsp; url: mapService.url + "/" + lyrId,
&amp;nbsp;&amp;nbsp;&amp;nbsp; content: {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f: "json"
&amp;nbsp;&amp;nbsp;&amp;nbsp; },
&amp;nbsp;&amp;nbsp;&amp;nbsp; handleAs: "json",
&amp;nbsp;&amp;nbsp;&amp;nbsp; callbackParamName: "callback"
}).then(function (jsonLayer) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; // NOTE: jsonLayer.extent is not a real Extent object, but just a json object
&amp;nbsp;&amp;nbsp;&amp;nbsp; map.setExtent(new esri.geometry.Extent(jsonLayer.extent));
});&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:46:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zooming-into-layers-from-a-dynamic-map-service/m-p/114111#M10624</guid>
      <dc:creator>JasonZou</dc:creator>
      <dc:date>2021-12-11T06:46:24Z</dc:date>
    </item>
    <item>
      <title>Re: Zooming into layers from a dynamic map service</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zooming-into-layers-from-a-dynamic-map-service/m-p/114112#M10625</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jason,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Instead of using a geometry service to union the extents together, why not just use the Extent's &lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/en/javascript/jsapi/extent-amd.html#union"&gt;Union method&lt;/A&gt;&lt;SPAN&gt; (assuming the extents have the same spatial reference)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Sep 2013 14:59:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zooming-into-layers-from-a-dynamic-map-service/m-p/114112#M10625</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2013-09-09T14:59:57Z</dc:date>
    </item>
    <item>
      <title>Re: Zooming into layers from a dynamic map service</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zooming-into-layers-from-a-dynamic-map-service/m-p/114113#M10626</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Good point, Ken! This is another way to union the extents one by one, and it should perform on the client side for a little performance gain.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Sep 2013 15:07:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zooming-into-layers-from-a-dynamic-map-service/m-p/114113#M10626</guid>
      <dc:creator>JasonZou</dc:creator>
      <dc:date>2013-09-09T15:07:04Z</dc:date>
    </item>
    <item>
      <title>Re: Zooming into layers from a dynamic map service</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zooming-into-layers-from-a-dynamic-map-service/m-p/114114#M10627</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks guys. The method works but unfortunately not the way I need it to. The problem I have is we have general layers for a specific type of data ... say ship tracks or dive locations. But these can be world-wide. In the map service, they are using a layer definition call to subsample out the points or lines for a particular cruise but the layer extent is for the whole general layer. So when I use this routine, it zooms to the extent of the general layer ... which is what you expect ... and not to the smaller subset.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Sep 2013 18:06:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zooming-into-layers-from-a-dynamic-map-service/m-p/114114#M10627</guid>
      <dc:creator>BetsySchenck-Gardner</dc:creator>
      <dc:date>2013-09-09T18:06:17Z</dc:date>
    </item>
    <item>
      <title>Re: Zooming into layers from a dynamic map service</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zooming-into-layers-from-a-dynamic-map-service/m-p/114115#M10628</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can use &lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/en/javascript/jsapi/namespace_esri-amd.html#graphicsExtent"&gt;esri.graphicsExtent&lt;/A&gt;&lt;SPAN&gt; to get the extent from an array of graphics. Just be warned that it won't work as expected if there is only one point in the graphics array.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Sep 2013 18:33:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zooming-into-layers-from-a-dynamic-map-service/m-p/114115#M10628</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2013-09-09T18:33:43Z</dc:date>
    </item>
    <item>
      <title>Re: Zooming into layers from a dynamic map service</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zooming-into-layers-from-a-dynamic-map-service/m-p/114116#M10629</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;So I created a jsfiddle example to show my results of trying to get the extent to work. None is coming back with the results I want. First setting uses map.setExtent(map.extent), second setting uses esri.request call, and third setting uses esri.graphicsExtent. Can you tell me what I'm doing wrong? Here's the link to jsfiddle example: &lt;/SPAN&gt;&lt;A href="http://jsfiddle.net/betsyjsg/8Ty9x/7/"&gt;http://jsfiddle.net/betsyjsg/8Ty9x/7/&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Sep 2013 12:53:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zooming-into-layers-from-a-dynamic-map-service/m-p/114116#M10629</guid>
      <dc:creator>BetsySchenck-Gardner</dc:creator>
      <dc:date>2013-09-11T12:53:21Z</dc:date>
    </item>
    <item>
      <title>Re: Zooming into layers from a dynamic map service</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zooming-into-layers-from-a-dynamic-map-service/m-p/114117#M10630</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think you need something like this......&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; GISLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://service.ncddc.noaa.gov/arcgis/rest/services/OceanExploration/regatlasSATL/MapServer", { "imageParameters": imageParameters });
&amp;nbsp;&amp;nbsp;&amp;nbsp; map.addLayer(GISLayer);
&amp;nbsp;&amp;nbsp; dojo.connect(GISLayer, 'onLoad', function(mapLayout) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.setExtent(GISLayer.fullExtent);
&amp;nbsp;&amp;nbsp;&amp;nbsp; });

&amp;nbsp;&amp;nbsp;&amp;nbsp; //1. set map extent example
&amp;nbsp;&amp;nbsp;&amp;nbsp; // map.setExtent(map.extent);&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:46:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zooming-into-layers-from-a-dynamic-map-service/m-p/114117#M10630</guid>
      <dc:creator>VinayBansal</dc:creator>
      <dc:date>2021-12-11T06:46:27Z</dc:date>
    </item>
    <item>
      <title>Re: Zooming into layers from a dynamic map service</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zooming-into-layers-from-a-dynamic-map-service/m-p/114118#M10631</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If you're trying to get the extent of the features within that particular layer, you can use the QueryTask to return all the features and set the extent from those features&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;queryTask = new esri.tasks.QueryTask("http://service.ncddc.noaa.gov/arcgis/rest/services/OceanExploration/regatlasSATL/MapServer/5"); query = new esri.tasks.Query(); query.returnGeometry = true; query.outFields = ["zkdiveid"]; query.where = "1=1";&amp;nbsp; queryTask.execute(query, function (fset) { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.setExtent(esri.graphicsExtent(fset.features)); });&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Sep 2013 17:24:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zooming-into-layers-from-a-dynamic-map-service/m-p/114118#M10631</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2013-09-11T17:24:14Z</dc:date>
    </item>
    <item>
      <title>Re: Zooming into layers from a dynamic map service</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zooming-into-layers-from-a-dynamic-map-service/m-p/114119#M10632</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Many thanks Ken. That was the solution that worked for me.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Sep 2013 12:32:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zooming-into-layers-from-a-dynamic-map-service/m-p/114119#M10632</guid>
      <dc:creator>BetsySchenck-Gardner</dc:creator>
      <dc:date>2013-09-12T12:32:16Z</dc:date>
    </item>
  </channel>
</rss>

