<?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: Automatically zoom out when no filtered features available in current extent in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/automatically-zoom-out-when-no-filtered-features/m-p/154792#M14408</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Bummer. You could always use some trigonometry and calculate the distance between two lat/long points to determine the closest facility to the current map extent but, like you said, 48k features is too many for this approach.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 06 Oct 2015 23:02:40 GMT</pubDate>
    <dc:creator>SteveCole</dc:creator>
    <dc:date>2015-10-06T23:02:40Z</dc:date>
    <item>
      <title>Automatically zoom out when no filtered features available in current extent</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/automatically-zoom-out-when-no-filtered-features/m-p/154786#M14402</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a featureLayer with a couple of dropdowns that define a filterExpression on the layer.&amp;nbsp; These are types of medical providers and for some specialty areas there aren't many specialists across the whole state. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a grid tied to the map, which lists out the features in the current map extent. Once a user has zoomed in, if they then change their filter to a specialty that isn't very common, there are no features displayed on the map, and the provider grid has a message that suggests they zoom out or change their filter to see some results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd like to help the user out more than this, by having the map automatically zoom out until there is at least one filtered features shown. I can't figure out how to do this without iteratively zooming out, checking if there are features yet, zooming out again, etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a less clunky process?&amp;nbsp; If that's the own solution, does anyone have a code snippet to share?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Oct 2015 15:14:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/automatically-zoom-out-when-no-filtered-features/m-p/154786#M14402</guid>
      <dc:creator>TracySchloss</dc:creator>
      <dc:date>2015-10-06T15:14:15Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically zoom out when no filtered features available in current extent</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/automatically-zoom-out-when-no-filtered-features/m-p/154787#M14403</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dont have a code snippet, logically you could calculate the zoom extent required. below are the steps, let me know if it makes sense.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt; query all the points/features with the required speciality&lt;/LI&gt;&lt;LI&gt;Find the nearest Feature to the center of current extent&lt;/LI&gt;&lt;LI&gt;get the delta x &amp;amp; delta y between center of current extent and the feature/point&lt;/LI&gt;&lt;LI&gt;Calculate the extent width and height where it is 2x delta values + some buffer distance.&lt;/LI&gt;&lt;/OL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Oct 2015 15:35:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/automatically-zoom-out-when-no-filtered-features/m-p/154787#M14403</guid>
      <dc:creator>thejuskambi</dc:creator>
      <dc:date>2015-10-06T15:35:10Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically zoom out when no filtered features available in current extent</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/automatically-zoom-out-when-no-filtered-features/m-p/154788#M14404</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Instead of actually zooming out, you could get the present extent of the map and use the &lt;A href="https://developers.arcgis.com/javascript/jsapi/extent-amd.html#expand"&gt;expand&lt;/A&gt; method to get a geometry that you could use in a query of the FeatureLayer. if that doesn't result in any features selected, then expand it again until you do. Then you set the map extent to that geometry.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You'd have to put a limit on when to break that iteration in case there aren't any features in the entire dataset.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Oct 2015 15:41:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/automatically-zoom-out-when-no-filtered-features/m-p/154788#M14404</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2015-10-06T15:41:39Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically zoom out when no filtered features available in current extent</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/automatically-zoom-out-when-no-filtered-features/m-p/154789#M14405</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How about some sort of closest facility GP task based on your current (empty) map extent? Once you get the next closest feature, pan the map to it's map extent.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Oct 2015 15:55:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/automatically-zoom-out-when-no-filtered-features/m-p/154789#M14405</guid>
      <dc:creator>SteveCole</dc:creator>
      <dc:date>2015-10-06T15:55:47Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically zoom out when no filtered features available in current extent</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/automatically-zoom-out-when-no-filtered-features/m-p/154790#M14406</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is true there are some menu choices for new categories.&amp;nbsp; It's possible the user could zoom out many times, eventually getting the whole state and never have any providers in that category.&amp;nbsp;&amp;nbsp; That's not a very user friendly experience.&amp;nbsp; I find it frustrating and I wrote it!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm hesitant to use the GP tools, since this data set has 49K records in it.&amp;nbsp; Some of my filtered features still have thousands of potential returns.&amp;nbsp; I guess I should try it and see what kind of performance I get.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Oct 2015 16:14:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/automatically-zoom-out-when-no-filtered-features/m-p/154790#M14406</guid>
      <dc:creator>TracySchloss</dc:creator>
      <dc:date>2015-10-06T16:14:50Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically zoom out when no filtered features available in current extent</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/automatically-zoom-out-when-no-filtered-features/m-p/154791#M14407</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;UPDATE:&amp;nbsp; FindClosestFacilityTask isn't a practical solution for this application.&amp;nbsp; Although it doesn't specifically say so, it requires an AGOL login and consumes credits.&amp;nbsp; I don't have a GP task available in my local environment.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Oct 2015 21:13:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/automatically-zoom-out-when-no-filtered-features/m-p/154791#M14407</guid>
      <dc:creator>TracySchloss</dc:creator>
      <dc:date>2015-10-06T21:13:21Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically zoom out when no filtered features available in current extent</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/automatically-zoom-out-when-no-filtered-features/m-p/154792#M14408</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Bummer. You could always use some trigonometry and calculate the distance between two lat/long points to determine the closest facility to the current map extent but, like you said, 48k features is too many for this approach.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Oct 2015 23:02:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/automatically-zoom-out-when-no-filtered-features/m-p/154792#M14408</guid>
      <dc:creator>SteveCole</dc:creator>
      <dc:date>2015-10-06T23:02:40Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically zoom out when no filtered features available in current extent</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/automatically-zoom-out-when-no-filtered-features/m-p/154793#M14409</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I had a similar project with just a couple hundred points and for that, it worked to calculate point to point distances and then sort my list of facilities from closest to farthest.&amp;nbsp; The performance wasn't bad for that number of features.&amp;nbsp; If I get some code worked out that has some sort of loop to zoom out and keep checking until there are features in the extent, I'll post it here.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Oct 2015 13:27:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/automatically-zoom-out-when-no-filtered-features/m-p/154793#M14409</guid>
      <dc:creator>TracySchloss</dc:creator>
      <dc:date>2015-10-07T13:27:57Z</dc:date>
    </item>
  </channel>
</rss>

