<?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: How to get the proper extent based on the data returned from map service in Web AppBuilder Custom Widgets Questions</title>
    <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-get-the-proper-extent-based-on-the-data/m-p/795407#M4617</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Michel,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Use the graphicsUtils graphicsextent method&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://developers.arcgis.com/javascript/3/jsapi/esri.graphicsutils-amd.html#graphicsextent" title="https://developers.arcgis.com/javascript/3/jsapi/esri.graphicsutils-amd.html#graphicsextent"&gt;esri/graphicsUtils | API Reference | ArcGIS API for JavaScript 3.34&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 30 Oct 2020 13:26:15 GMT</pubDate>
    <dc:creator>RobertScheitlin__GISP</dc:creator>
    <dc:date>2020-10-30T13:26:15Z</dc:date>
    <item>
      <title>How to get the proper extent based on the data returned from map service</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-get-the-proper-extent-based-on-the-data/m-p/795406#M4616</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using Web AppBuilder 2.6 to create a widget.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an ArcGIS Map Service that contains the name of several companies and their offices' location in north America. The user interface provides a list of the company names, the user selects a company name and the service returns the offices' location for the requested company name and then the new layer is added to the map. In some instances, the offices are located in one state in other instances the offices are located all across&amp;nbsp; North America.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My question is how can I find the appropriate extent so that all offices' locations are present under the presented map?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In other words, if all returned offices' location are in one state then the map view shows only that state and in the case where the offices' location&amp;nbsp; are allover North America then the map view would show all North America.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I understand that I can set the extent programmatically as the map is initialized within the widget. I need a method to find the appropriate extent.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 21:03:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-get-the-proper-extent-based-on-the-data/m-p/795406#M4616</guid>
      <dc:creator>MichelTurmel</dc:creator>
      <dc:date>2020-10-29T21:03:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the proper extent based on the data returned from map service</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-get-the-proper-extent-based-on-the-data/m-p/795407#M4617</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Michel,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Use the graphicsUtils graphicsextent method&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://developers.arcgis.com/javascript/3/jsapi/esri.graphicsutils-amd.html#graphicsextent" title="https://developers.arcgis.com/javascript/3/jsapi/esri.graphicsutils-amd.html#graphicsextent"&gt;esri/graphicsUtils | API Reference | ArcGIS API for JavaScript 3.34&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Oct 2020 13:26:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-get-the-proper-extent-based-on-the-data/m-p/795407#M4617</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2020-10-30T13:26:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the proper extent based on the data returned from map service</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-get-the-proper-extent-based-on-the-data/m-p/795408#M4618</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much for the information Robert!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Oct 2020 15:05:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-get-the-proper-extent-based-on-the-data/m-p/795408#M4618</guid>
      <dc:creator>MichelTurmel</dc:creator>
      <dc:date>2020-10-30T15:05:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the proper extent based on the data returned from map service</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-get-the-proper-extent-based-on-the-data/m-p/795409#M4619</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is what I have done:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;........&lt;BR /&gt; &lt;BR /&gt; var aSearch = "OP LIKE 'something'";&lt;BR /&gt; var queryTask = new QueryTask("https://.../MapServer/0");&lt;BR /&gt; var query = new Query();&lt;BR /&gt; query.returnGeometry = true;&lt;BR /&gt; query.returnCountOnly = false;&lt;BR /&gt; query.outFields = ["OP"];&lt;BR /&gt; query.where = aSearch;&lt;/P&gt;&lt;P&gt;queryTask.execute(query, this.aShowResults);&lt;BR /&gt; &lt;BR /&gt; ....&lt;BR /&gt; aShowResults: function(results){&lt;BR /&gt; aCount = results.features.length;&lt;/P&gt;&lt;P&gt;if (aCount !== 0) {&lt;BR /&gt; aExtent = graphicsUtils.graphicsExtent(results.features);&lt;BR /&gt; }&lt;BR /&gt; &lt;BR /&gt; addLayersToMap();&lt;BR /&gt; },&lt;/P&gt;&lt;P&gt;......&lt;BR /&gt; &lt;BR /&gt;function addLayersToMap(){&lt;BR /&gt; map.addLayers([.......]);&lt;BR /&gt; map.setExtent(aExtent);&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your help is really appreciated, you sent me in the right direction!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Nov 2020 22:11:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-get-the-proper-extent-based-on-the-data/m-p/795409#M4619</guid>
      <dc:creator>MichelTurmel</dc:creator>
      <dc:date>2020-11-02T22:11:44Z</dc:date>
    </item>
  </channel>
</rss>

