<?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: Extent of All Features is... sticking, can't pan or zoom away in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/extent-of-all-features-is-sticking-can-t-pan-or/m-p/1001809#M70820</link>
    <description>&lt;P&gt;Evan,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Your issue is that the way you have your code every time the layer is done updating it will zoom to the features extent. If you are wanting this to only happen initially them you need to remove the event handler or you could use watch utils to use the whenfalseonce method&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-core-watchUtils.html#whenFalseOnce" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-core-watchUtils.html#whenFalseOnce&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So something like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var handle = layerView.watch("updating", function(val) {
  // wait for the layer view to finish updating
  if (!val) {
    layerView.queryExtent().then(function(response) {
      //remove the layer updating watch handler
      handle.remove();
      // go to the extent of all the graphics in the layer view
      view.goTo(response.extent);
    });
  }
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 16 Nov 2020 17:05:50 GMT</pubDate>
    <dc:creator>RobertScheitlin__GISP</dc:creator>
    <dc:date>2020-11-16T17:05:50Z</dc:date>
    <item>
      <title>Extent of All Features is... sticking, can't pan or zoom away</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/extent-of-all-features-is-sticking-can-t-pan-or/m-p/1001784#M70819</link>
      <description>&lt;P&gt;I thought I was implementing a simple "zoom to extent" function, which works... but it also doesnt let you zoom away from the area... I didnt think this was the intention of this code. Can someone advise. I would prefer to zoom on load and then let the use zoom away afterward.&lt;/P&gt;&lt;P&gt;Here is the page... try to pan or zoom away just a little on the inset map... you'll see&lt;/P&gt;&lt;P&gt;&lt;A href="https://data.orangeville.ca/Apps/PlanningApplications/property.html?gid={B85BF5C1-2EF2-4E98-9F4B-94FBC4D15708}" target="_blank" rel="noopener"&gt;https://data.orangeville.ca/Apps/PlanningApplications/property.html?gid={B85BF5C1-2EF2-4E98-9F4B-94FBC4D15708}&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my reference&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/featurelayer-queryextent/index.html" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/sample-code/featurelayer-queryextent/index.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code for the map (4.16),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;require([&lt;BR /&gt;"esri/Map",&lt;BR /&gt;"esri/views/MapView",&lt;BR /&gt;"esri/layers/FeatureLayer",&lt;BR /&gt;"esri/widgets/BasemapToggle"&lt;BR /&gt;], function (Map, MapView, FeatureLayer, BasemapToggle) {&lt;BR /&gt;// Create the Map with an initial basemap&lt;BR /&gt;var map = new Map({&lt;BR /&gt;basemap: "topo-vector"&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;// Create the MapView and reference the Map in the instance&lt;BR /&gt;var view = new MapView({&lt;BR /&gt;container: "map",&lt;BR /&gt;map: map,&lt;BR /&gt;center: [-80.106,43.916],&lt;BR /&gt;zoom: 13&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;var defexp = 'GlobalID = \'' + getUrlParameter('gid') + '\''&lt;BR /&gt;var featureLayer = new FeatureLayer({ url: "&lt;A href="https://gis.orangeville.ca/arcgis/rest/services/PlanningCadastre/PlanningApplications/FeatureServer/0" target="_blank"&gt;https://gis.orangeville.ca/arcgis/rest/services/PlanningCadastre/PlanningApplications/FeatureServer/0&lt;/A&gt;",&lt;BR /&gt;definitionExpression: defexp&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;map.add(featureLayer);&lt;/P&gt;&lt;P&gt;view.whenLayerView(featureLayer).then(function(layerView) {&lt;BR /&gt;layerView.watch("updating", function(val) {&lt;BR /&gt;// wait for the layer view to finish updating&lt;BR /&gt;if (!val) {&lt;BR /&gt;layerView.queryExtent().then(function(response) {&lt;BR /&gt;// go to the extent of all the graphics in the layer view&lt;BR /&gt;view.goTo(response.extent);&lt;BR /&gt;});&lt;BR /&gt;}&lt;BR /&gt;});&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;// Makes the layer 50% transparent&lt;BR /&gt;featureLayer.opacity = 0.5;&lt;/P&gt;&lt;P&gt;// 1 - Create the widget&lt;BR /&gt;var toggle = new BasemapToggle({&lt;BR /&gt;// 2 - Set properties&lt;BR /&gt;view: view, // view that provides access to the map's 'topo-vector' basemap&lt;BR /&gt;nextBasemap: "satellite" // allows for toggling to the 'hybrid' basemap&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;// Add widget to the top right corner of the view&lt;BR /&gt;view.ui.add(toggle, "top-right");&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Nov 2020 16:24:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/extent-of-all-features-is-sticking-can-t-pan-or/m-p/1001784#M70819</guid>
      <dc:creator>AwesomeEvan</dc:creator>
      <dc:date>2020-11-16T16:24:56Z</dc:date>
    </item>
    <item>
      <title>Re: Extent of All Features is... sticking, can't pan or zoom away</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/extent-of-all-features-is-sticking-can-t-pan-or/m-p/1001809#M70820</link>
      <description>&lt;P&gt;Evan,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Your issue is that the way you have your code every time the layer is done updating it will zoom to the features extent. If you are wanting this to only happen initially them you need to remove the event handler or you could use watch utils to use the whenfalseonce method&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-core-watchUtils.html#whenFalseOnce" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-core-watchUtils.html#whenFalseOnce&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So something like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var handle = layerView.watch("updating", function(val) {
  // wait for the layer view to finish updating
  if (!val) {
    layerView.queryExtent().then(function(response) {
      //remove the layer updating watch handler
      handle.remove();
      // go to the extent of all the graphics in the layer view
      view.goTo(response.extent);
    });
  }
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Nov 2020 17:05:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/extent-of-all-features-is-sticking-can-t-pan-or/m-p/1001809#M70820</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2020-11-16T17:05:50Z</dc:date>
    </item>
  </channel>
</rss>

