<?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 Feature in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zoom-to-feature/m-p/133397#M12428</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm doing something very similar; however, i'm using a featureLayer and setting the definitionExpression. I would like to zoom to the features in my featureLayer that satisfy my definitionExpression. Is this possible?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 Nov 2012 19:33:29 GMT</pubDate>
    <dc:creator>AndrewBrown1</dc:creator>
    <dc:date>2012-11-29T19:33:29Z</dc:date>
    <item>
      <title>Zoom to Feature</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zoom-to-feature/m-p/133393#M12424</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am new to javascript and am looking for a little guidance as to zooming to a single point in a feature layer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am adding a layer to my map that will only have 1 record based on an input field. I would like to center and zoom to that point when the app initializes and then when someone changes the value and clicks submit. For the life of me I can figure out how to zoom to the point that is in that layer. Here is my code to add the layer. Any suggestions? I've tried many things including querying the layer and zooming to the extent of the results with no luck. Please help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
HOPolicies = new esri.layers.FeatureLayer("http://webmapping/ArcGIS/rest/services/Policies/PoliciesSDE/MapServer/0", { 
mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
outFields: ["*"] 
 }); 
temp = input.value
HOPolicies.setDefinitionExpression("POLICY_NO = '" + temp +"'");
map.addLayers([HOPolicies]);
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Oct 2012 18:38:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zoom-to-feature/m-p/133393#M12424</guid>
      <dc:creator>BrianLeroux</dc:creator>
      <dc:date>2012-10-12T18:38:41Z</dc:date>
    </item>
    <item>
      <title>Re: Zoom to Feature</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zoom-to-feature/m-p/133394#M12425</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/map.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/map.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
dojo.connect(map, 'onLoad', function () {
&amp;nbsp;&amp;nbsp;&amp;nbsp; //start query and get point
&amp;nbsp;&amp;nbsp;&amp;nbsp; //map.centerAt(myPoint);
&amp;nbsp;&amp;nbsp;&amp;nbsp; // or
&amp;nbsp;&amp;nbsp;&amp;nbsp; //map.centerAndZoom(myPoint,12);
});
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:28:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zoom-to-feature/m-p/133394#M12425</guid>
      <dc:creator>DouglasHall</dc:creator>
      <dc:date>2021-12-11T07:28:53Z</dc:date>
    </item>
    <item>
      <title>Re: Zoom to Feature</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zoom-to-feature/m-p/133395#M12426</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Douglas. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How do i assiggn myPOint to the one record in my feature layer? I have tried using the methods you mention but can't seem to pass hte correct data to get it to work properly.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Oct 2012 19:11:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zoom-to-feature/m-p/133395#M12426</guid>
      <dc:creator>BrianLeroux</dc:creator>
      <dc:date>2012-10-12T19:11:46Z</dc:date>
    </item>
    <item>
      <title>Re: Zoom to Feature</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zoom-to-feature/m-p/133396#M12427</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
dojo.connect(map, 'onLoad', function () {
&amp;nbsp;&amp;nbsp;&amp;nbsp; var query = new esri.tasks.Query();
&amp;nbsp;&amp;nbsp;&amp;nbsp; var queryTask = new esri.tasks.QueryTask("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/PublicSafety/PublicSafetyFeedSample/MapServer/0");
&amp;nbsp;&amp;nbsp;&amp;nbsp; query.where = "OBJECTID &amp;gt; 0";
&amp;nbsp;&amp;nbsp;&amp;nbsp; query.returnGeometry = true;
&amp;nbsp;&amp;nbsp;&amp;nbsp; query.outFields = ["*"];
&amp;nbsp;&amp;nbsp;&amp;nbsp; queryTask.execute(query, function (results) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.centerAndZoom(results.features[0].geometry, 12);
&amp;nbsp;&amp;nbsp;&amp;nbsp; }, function (error) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(error);
&amp;nbsp;&amp;nbsp;&amp;nbsp; });
});
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:28:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zoom-to-feature/m-p/133396#M12427</guid>
      <dc:creator>DouglasHall</dc:creator>
      <dc:date>2021-12-11T07:28:56Z</dc:date>
    </item>
    <item>
      <title>Re: Zoom to Feature</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zoom-to-feature/m-p/133397#M12428</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm doing something very similar; however, i'm using a featureLayer and setting the definitionExpression. I would like to zoom to the features in my featureLayer that satisfy my definitionExpression. Is this possible?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Nov 2012 19:33:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zoom-to-feature/m-p/133397#M12428</guid>
      <dc:creator>AndrewBrown1</dc:creator>
      <dc:date>2012-11-29T19:33:29Z</dc:date>
    </item>
  </channel>
</rss>

