<?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: What's the best way to zoom to a single feature after a QueryTask? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/what-s-the-best-way-to-zoom-to-a-single-feature/m-p/1112169#M75111</link>
    <description>&lt;P&gt;Thanks, that does seem to work, but I don't understand how it's setting the scale level. It's too far out for what I'm wanting, but it does locate the feature.&lt;/P&gt;&lt;P&gt;I think I'll just keep doing it how I always have since I can easily get the scale level I want using expand:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;servicePoint_QT.execute(meterNumber_Q).then(zoomToServicePoint);

function zoomToServicePoint(results) {
    var geometry = results.features[0].geometry;
    var buffer = geometryEngine.buffer(geometry, 10, 'feet');

    view.extent = buffer.extent.expand(3);
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 28 Oct 2021 15:56:04 GMT</pubDate>
    <dc:creator>_____</dc:creator>
    <dc:date>2021-10-28T15:56:04Z</dc:date>
    <item>
      <title>What's the best way to zoom to a single feature after a QueryTask?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/what-s-the-best-way-to-zoom-to-a-single-feature/m-p/1112149#M75109</link>
      <description>&lt;P&gt;On map load I want to zoom the map to a specific single feature, what's the best way to do this?&lt;/P&gt;&lt;P&gt;`executeForExtent` doesn't work because the single feature doesn't have an extent.&lt;/P&gt;&lt;P&gt;I think in the past I buffered the returned feature's geometry and zoomed to that created polygon feature. Is that still the best way to do this?&lt;/P&gt;</description>
      <pubDate>Thu, 28 Oct 2021 15:47:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/what-s-the-best-way-to-zoom-to-a-single-feature/m-p/1112149#M75109</guid>
      <dc:creator>_____</dc:creator>
      <dc:date>2021-10-28T15:47:19Z</dc:date>
    </item>
    <item>
      <title>Re: What's the best way to zoom to a single feature after a QueryTask?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/what-s-the-best-way-to-zoom-to-a-single-feature/m-p/1112163#M75110</link>
      <description>&lt;P&gt;I think&amp;nbsp;&lt;SPAN&gt;view.goTo(response.extent) will work with the response from your querytask.&amp;nbsp; Just a reminder that querytask (&lt;A title="QueryTask" href="https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-QueryTask.html" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-QueryTask.html&lt;/A&gt;&amp;nbsp;) has been deprecated as of 4.21 and Esri is recommending the use of Query instead (&lt;A title="Query" href="https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html&lt;/A&gt;&amp;nbsp;).&amp;nbsp; This is Esri's sample page&amp;nbsp;&lt;A title="Zom to" href="https://developers.arcgis.com/javascript/latest/sample-code/featurelayer-queryextent/" target="_self"&gt;https://developers.arcgis.com/javascript/latest/sample-code/featurelayer-queryextent/&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Oct 2021 15:42:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/what-s-the-best-way-to-zoom-to-a-single-feature/m-p/1112163#M75110</guid>
      <dc:creator>JeffreyWilkerson</dc:creator>
      <dc:date>2021-10-28T15:42:45Z</dc:date>
    </item>
    <item>
      <title>Re: What's the best way to zoom to a single feature after a QueryTask?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/what-s-the-best-way-to-zoom-to-a-single-feature/m-p/1112169#M75111</link>
      <description>&lt;P&gt;Thanks, that does seem to work, but I don't understand how it's setting the scale level. It's too far out for what I'm wanting, but it does locate the feature.&lt;/P&gt;&lt;P&gt;I think I'll just keep doing it how I always have since I can easily get the scale level I want using expand:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;servicePoint_QT.execute(meterNumber_Q).then(zoomToServicePoint);

function zoomToServicePoint(results) {
    var geometry = results.features[0].geometry;
    var buffer = geometryEngine.buffer(geometry, 10, 'feet');

    view.extent = buffer.extent.expand(3);
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Oct 2021 15:56:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/what-s-the-best-way-to-zoom-to-a-single-feature/m-p/1112169#M75111</guid>
      <dc:creator>_____</dc:creator>
      <dc:date>2021-10-28T15:56:04Z</dc:date>
    </item>
    <item>
      <title>Re: What's the best way to zoom to a single feature after a QueryTask?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/what-s-the-best-way-to-zoom-to-a-single-feature/m-p/1112427#M75124</link>
      <description>&lt;P&gt;Is using goTo() as Jeffery mentions, and working with point geometries and you need a specific zoom scale, you might want to try using some of the other 'goTo()' parameters, maybe something like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;servicePoint_QT.execute(meterNumber_Q).then(zoomToServicePoint);

function zoomToServicePoint(results) {
    var geometry = results.features[0].geometry;
    view.goTo({target:geometry, scale: 12500});
}&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#goTo" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#goTo&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#GoToOptions2D" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#GoToOptions2D&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Oct 2021 15:23:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/what-s-the-best-way-to-zoom-to-a-single-feature/m-p/1112427#M75124</guid>
      <dc:creator>JohnGrayson</dc:creator>
      <dc:date>2021-10-29T15:23:11Z</dc:date>
    </item>
  </channel>
</rss>

