<?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: After setLayerDefinitions on a ArcGISDynamicMapServiceLayer zoom to results in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/after-setlayerdefinitions-on-a/m-p/725549#M67360</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tried something similar, but the extent would be wrong if I didn't wait for the "update-end" event. Otherwise it would zoom to part of the shapes and leave others off the screen.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 15 Aug 2017 12:46:59 GMT</pubDate>
    <dc:creator>GareySmiley</dc:creator>
    <dc:date>2017-08-15T12:46:59Z</dc:date>
    <item>
      <title>After setLayerDefinitions on a ArcGISDynamicMapServiceLayer zoom to results</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/after-setlayerdefinitions-on-a/m-p/725541#M67352</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;After&amp;nbsp;doing a setLayerDefinitions on a ArcGISDynamicMapServiceLayer layer. How do I zoom to results?&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 Aug 2017 19:50:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/after-setlayerdefinitions-on-a/m-p/725541#M67352</guid>
      <dc:creator>GareySmiley</dc:creator>
      <dc:date>2017-08-13T19:50:38Z</dc:date>
    </item>
    <item>
      <title>Re: After setLayerDefinitions on a ArcGISDynamicMapServiceLayer zoom to results</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/after-setlayerdefinitions-on-a/m-p/725542#M67353</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P class=""&gt;What version of ArcGIS Server are you using? If you are using one that supports queryExtent that that is the best way.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Aug 2017 01:11:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/after-setlayerdefinitions-on-a/m-p/725542#M67353</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2017-08-14T01:11:46Z</dc:date>
    </item>
    <item>
      <title>Re: After setLayerDefinitions on a ArcGISDynamicMapServiceLayer zoom to results</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/after-setlayerdefinitions-on-a/m-p/725543#M67354</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ArcGIS Server is 10.5.1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;queryExtent I believe is only available with a FeatureLayer, not a&amp;nbsp;ArcGISDynamicMapServiceLayer. Hence why I'm asking the question about how to do it with a&amp;nbsp;&lt;SPAN&gt;ArcGISDynamicMapServiceLayer.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Aug 2017 17:47:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/after-setlayerdefinitions-on-a/m-p/725543#M67354</guid>
      <dc:creator>GareySmiley</dc:creator>
      <dc:date>2017-08-14T17:47:36Z</dc:date>
    </item>
    <item>
      <title>Re: After setLayerDefinitions on a ArcGISDynamicMapServiceLayer zoom to results</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/after-setlayerdefinitions-on-a/m-p/725544#M67355</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Garey,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;Any query (like queryExtent) is going to be specific to a individual layer in a map service just like a definition query would be too. Unfortunately applying a definition expression does not alter the extent returned for that map service so there is no easy way to just zoom to the extent of the set definition expression.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Aug 2017 18:59:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/after-setlayerdefinitions-on-a/m-p/725544#M67355</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2017-08-14T18:59:22Z</dc:date>
    </item>
    <item>
      <title>Re: After setLayerDefinitions on a ArcGISDynamicMapServiceLayer zoom to results</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/after-setlayerdefinitions-on-a/m-p/725545#M67356</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Okay figured this out. no way to do it directly with a&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;ArcGISDynamicMapServiceLayer, so you need to create a temporary FeatureLayer and get the extent of it after applying the same definition expression&amp;nbsp;that was applied to the&amp;nbsp;&lt;SPAN&gt;ArcGISDynamicMapServiceLayer. Sorry about the formatting. When you cut and paste it strips the tabs.&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;function WDsetDefinitionExpressionDone(results) {&lt;BR /&gt; if (results.error) {&lt;BR /&gt; alert("Error occured getting WD trade area. "+results.error.message);&lt;BR /&gt; console.log("results.error",results.error);&lt;BR /&gt;} else {&lt;/P&gt;&lt;P&gt;try {&lt;BR /&gt; // Hide layer while we calc renderer and re-display&lt;BR /&gt; wdLayer.hide();&lt;BR /&gt; &lt;BR /&gt; // Zoom to the layers objects&lt;BR /&gt;var filterDefinition = wdLayer.layerDefinitions[1];&lt;BR /&gt;var tempLayer = new esri.layers.FeatureLayer(&lt;BR /&gt;&lt;SPAN&gt; "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fmktserv5.goodyear.com%3A6443%2Farcgis%2Frest%2Fservices%2FMarketAnalysis%2FMarketAnalysis_WD_TradeAreas%2FMapServer%2F1" rel="nofollow" target="_blank"&gt;https://mktserv5.goodyear.com:6443/arcgis/rest/services/MarketAnalysis/MarketAnalysis_WD_TradeAreas/MapServer/1&lt;/A&gt;&lt;SPAN&gt;",&lt;/SPAN&gt;&lt;BR /&gt; { &lt;BR /&gt; id: "Temp Feature Layer"&lt;BR /&gt; ,outFields: ["*"] &lt;BR /&gt; }&lt;BR /&gt; );&lt;BR /&gt;&lt;BR /&gt; var queryObject = new query();&lt;BR /&gt; queryObject.where = filterDefinition;&lt;BR /&gt; tempLayer.queryExtent(queryObject,function(response) {&lt;BR /&gt; // queryExtent worked. &lt;BR /&gt; &lt;BR /&gt;var extent = response.extent;&lt;BR /&gt; if (extent) {&lt;BR /&gt; extent.expand(2.0);&lt;BR /&gt; map.setExtent(extent).then(function (response) {&lt;BR /&gt; // Color code the layer&lt;BR /&gt;var promise = smartMapping.createClassedColorRenderer({&lt;BR /&gt; layer: tempLayer&lt;BR /&gt; ,field: "MARKETANALYSIS.WD_SUBGEO_SALES.WD_NET_PURCHASES_UNITS"&lt;BR /&gt; ,showOthers: true&lt;BR /&gt; ,basemap: map.getBasemap()&lt;BR /&gt; ,classificationMethod: "natural-breaks"&lt;BR /&gt; ,numClasses: 6&lt;BR /&gt; }).then(function (response) {&lt;BR /&gt;&lt;BR /&gt; // Color coding completed now display it&lt;BR /&gt; var layerDrawingOptions = []; &lt;BR /&gt; var layerDrawingOption1 = new esri.layers.LayerDrawingOptions();&lt;BR /&gt; layerDrawingOption1.renderer = response.renderer;&lt;BR /&gt; layerDrawingOptions[1] = layerDrawingOption1;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; wdLayer.setLayerDrawingOptions(layerDrawingOptions,true);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; // Have to toggle layer on and off to make sure colors always display.&lt;BR /&gt; wdLayer.hide();&lt;BR /&gt; wdLayer.show();&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; },function (error) {&lt;BR /&gt; console.log("WD Coloring Error",error);&lt;BR /&gt; alert("WD Coloring Error: "+error);&lt;BR /&gt;});&lt;BR /&gt; &lt;BR /&gt; });&lt;BR /&gt; } else {&lt;BR /&gt; console.log("Error getting extent of trade area from tempLayer",tempLayer); &lt;BR /&gt; alert("Error getting extent of trade area");&lt;BR /&gt; } &lt;BR /&gt; &lt;BR /&gt; }, function(error){&lt;BR /&gt; // Error querying extent&lt;BR /&gt; console.log("tempLayer.queryExtent error",error); &lt;BR /&gt; alert("tempLayer.queryExtent error");&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;// // Setup fuction to run after filter is applied&lt;BR /&gt;// dojo.on.once(tempLayer, "update-end", zoomTempLayer);&lt;BR /&gt;// // Apply the filter&lt;BR /&gt;// tempLayer.setDefinitionExpression(filterDefinition);&lt;BR /&gt; &lt;BR /&gt; } catch ($err) {&lt;BR /&gt; console.log("Error color coding WD Trade Area", $err);&lt;BR /&gt; alert("Error color coding WD Trade Area: $err");&lt;BR /&gt; }&lt;BR /&gt; } &lt;BR /&gt; }&lt;BR /&gt; &lt;BR /&gt;// wdLayer.setDefinitionExpression("WKUNNR='" + wkunnr + "'")&lt;BR /&gt; var definitions = [];&lt;BR /&gt; definitions[1] = "WKUNNR='" + wkunnr + "'";&lt;BR /&gt;wdLayer.setLayerDefinitions(definitions);&lt;BR /&gt; dojo.on.once(wdLayer, "update-end", WDsetDefinitionExpressionDone);&lt;BR /&gt; // "update-end" won't happen unless layer is displayed.&lt;BR /&gt; map.addLayer(wdLayer);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Aug 2017 20:46:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/after-setlayerdefinitions-on-a/m-p/725545#M67356</guid>
      <dc:creator>GareySmiley</dc:creator>
      <dc:date>2017-08-14T20:46:07Z</dc:date>
    </item>
    <item>
      <title>Re: After setLayerDefinitions on a ArcGISDynamicMapServiceLayer zoom to results</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/after-setlayerdefinitions-on-a/m-p/725546#M67357</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Garey,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;Honestly that is overkill. Just use a queryTask and query to get the extent of the specific layer in the&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;ArcGISDynamicMapServiceLayer that you are applying the definition to.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Aug 2017 20:58:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/after-setlayerdefinitions-on-a/m-p/725546#M67357</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2017-08-14T20:58:39Z</dc:date>
    </item>
    <item>
      <title>Re: After setLayerDefinitions on a ArcGISDynamicMapServiceLayer zoom to results</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/after-setlayerdefinitions-on-a/m-p/725547#M67358</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Okay. Have an example? Didn't think you could get to sub layers within a&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;ArcGISDynamicMapServiceLayer&lt;SPAN&gt;&amp;nbsp;as a featureLayer to do a queryExtent.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Aug 2017 21:10:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/after-setlayerdefinitions-on-a/m-p/725547#M67358</guid>
      <dc:creator>GareySmiley</dc:creator>
      <dc:date>2017-08-14T21:10:32Z</dc:date>
    </item>
    <item>
      <title>Re: After setLayerDefinitions on a ArcGISDynamicMapServiceLayer zoom to results</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/after-setlayerdefinitions-on-a/m-p/725548#M67359</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Garey,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Sure here is a snippet&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;//be sure to require QueryTask&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;//require(["esri/tasks/QueryTask"], function(QueryTask) {&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// Zoom to the layers objects&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; queryTask &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;new&lt;/SPAN&gt; &lt;SPAN class="token class-name"&gt;QueryTask&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fmktserv5.goodyear.com%3A6443%2Farcgis%2Frest%2Fservices%2FMarketAnalysis%2FMarketAnalysis_WD_TradeAreas%2FMapServer%2F1" target="_blank"&gt;https://mktserv5.goodyear.com:6443/arcgis/rest/services/MarketAnalysis/MarketAnalysis_WD_TradeAreas/MapServer/1&lt;/A&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; queryObject &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;new&lt;/SPAN&gt; &lt;SPAN class="token class-name"&gt;query&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
queryObject&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;where &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; wdLayer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;layerDefinitions&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
queryTask&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;queryExtent&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;queryObject&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;function&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;response&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;:&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:01:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/after-setlayerdefinitions-on-a/m-p/725548#M67359</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-12T07:01:39Z</dc:date>
    </item>
    <item>
      <title>Re: After setLayerDefinitions on a ArcGISDynamicMapServiceLayer zoom to results</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/after-setlayerdefinitions-on-a/m-p/725549#M67360</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tried something similar, but the extent would be wrong if I didn't wait for the "update-end" event. Otherwise it would zoom to part of the shapes and leave others off the screen.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Aug 2017 12:46:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/after-setlayerdefinitions-on-a/m-p/725549#M67360</guid>
      <dc:creator>GareySmiley</dc:creator>
      <dc:date>2017-08-15T12:46:59Z</dc:date>
    </item>
    <item>
      <title>Re: After setLayerDefinitions on a ArcGISDynamicMapServiceLayer zoom to results</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/after-setlayerdefinitions-on-a/m-p/725550#M67361</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Garey,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;That was because you were relying on a layer to get the definition query applied. Using a QueryTask is very different.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Aug 2017 12:51:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/after-setlayerdefinitions-on-a/m-p/725550#M67361</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2017-08-15T12:51:31Z</dc:date>
    </item>
  </channel>
</rss>

