<?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 Zoom on feature layer problem in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zoom-on-feature-layer-problem/m-p/186321#M17318</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi, i have the following code to zoom to an extent depending on the the query result. The zoom works certain times on firefox but &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;doesn't work on chrome.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;What could be the problem?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featureLayer.selectFeatures(query, esri.layers.FeatureLayer.SELECTION_NEW, function (features) {
&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var extent = features[0].geometry.getExtent().expand(1.25);
&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.setExtent(extent, true);
&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;&amp;nbsp; }
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 16 May 2014 13:37:10 GMT</pubDate>
    <dc:creator>RyanSmith1</dc:creator>
    <dc:date>2014-05-16T13:37:10Z</dc:date>
    <item>
      <title>Zoom on feature layer problem</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zoom-on-feature-layer-problem/m-p/186321#M17318</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi, i have the following code to zoom to an extent depending on the the query result. The zoom works certain times on firefox but &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;doesn't work on chrome.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;What could be the problem?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featureLayer.selectFeatures(query, esri.layers.FeatureLayer.SELECTION_NEW, function (features) {
&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var extent = features[0].geometry.getExtent().expand(1.25);
&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.setExtent(extent, true);
&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;&amp;nbsp; }
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 May 2014 13:37:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zoom-on-feature-layer-problem/m-p/186321#M17318</guid>
      <dc:creator>RyanSmith1</dc:creator>
      <dc:date>2014-05-16T13:37:10Z</dc:date>
    </item>
    <item>
      <title>Re: Zoom on feature layer problem</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zoom-on-feature-layer-problem/m-p/186322#M17319</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I occasionally have problems with both selecting and querying and I always think it relates to the callback function executing before the selection is really complete.&amp;nbsp; Network connectivity, the type and number of features you're selecting can impact whether the selection happens 'instantly' or not.&amp;nbsp; Points seem to be OK, but when I had a project where I was selecting lines with lots of vertices, there was often a problem. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I have this happen, adding selection-complete listener to your featureLayer and then execute the selection without the callback function takes care of this problem.&amp;nbsp; The syntax changes up a bit.&amp;nbsp; Instead of getting to feature like "results[0]" you have to use "results.features[0]".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myLayer.on('selection-complete', selectFeatureHandler);
myLayer.selectFeatures(query); 

function selectFeatureHandler (results) {
 var feature = results.features[0];
 map.setExtent(feature.geometry.getExtent().expand(1.25));
}
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:26:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zoom-on-feature-layer-problem/m-p/186322#M17319</guid>
      <dc:creator>TracySchloss</dc:creator>
      <dc:date>2021-12-11T09:26:24Z</dc:date>
    </item>
    <item>
      <title>Re: Zoom on feature layer problem</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zoom-on-feature-layer-problem/m-p/186323#M17320</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I occasionally have problems with both selecting and querying and I always think it relates to the callback function executing before the selection is really complete.&amp;nbsp; Network connectivity, the type and number of features you're selecting can impact whether the selection happens 'instantly' or not.&amp;nbsp; Points seem to be OK, but when I had a project where I was selecting lines with lots of vertices, there was often a problem. &lt;BR /&gt;&lt;BR /&gt;When I have this happen, adding selection-complete listener to your featureLayer and then execute the selection without the callback function takes care of this problem.&amp;nbsp; The syntax changes up a bit.&amp;nbsp; Instead of getting to feature like "results[0]" you have to use "results.features[0]".&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myLayer.on('selection-complete', selectFeatureHandler);
myLayer.selectFeatures(query); 

function selectFeatureHandler (results) {
 var feature = results.features[0];
 map.setExtent(feature.geometry.getExtent().expand(1.25));
}
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Tracy, thanks for this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It really has improved processing time of the zoom and seems to be working on firefox but still no luck on chrome. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Not sure why this is happening.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:26:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zoom-on-feature-layer-problem/m-p/186323#M17320</guid>
      <dc:creator>RyanSmith1</dc:creator>
      <dc:date>2021-12-11T09:26:26Z</dc:date>
    </item>
  </channel>
</rss>

