<?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 extent working for multi points but not single point in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zoom-to-extent-working-for-multi-points-but-not/m-p/661362#M61735</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This is a limitation with graphicsExtent.&amp;nbsp; You basically have to check for a single point and, if that's the case, use the centerAndZoom function.&amp;nbsp; Look below for a solution:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.arcgis.com/threads/93686-graphicsExtent-and-the-single-point"&gt;http://forums.arcgis.com/threads/93686-graphicsExtent-and-the-single-point&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 30 May 2014 18:58:16 GMT</pubDate>
    <dc:creator>ScottGunn</dc:creator>
    <dc:date>2014-05-30T18:58:16Z</dc:date>
    <item>
      <title>Zoom to extent working for multi points but not single point</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zoom-to-extent-working-for-multi-points-but-not/m-p/661361#M61734</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a filter by points working so when a user types something into a text box and hits a button it queries the map and zooms them to the queried results. This works fine for multiple points but is not working when the result is just a single point. Below is my code. Thanks in advance!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;//remove all graphics on the maps graphics layer
&amp;nbsp;&amp;nbsp;&amp;nbsp; map.graphics.clear();
 var extent = esri.graphicsExtent(featureSet.features); 
 map.setExtent(extent.expand(1), true);
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 May 2014 17:46:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zoom-to-extent-working-for-multi-points-but-not/m-p/661361#M61734</guid>
      <dc:creator>DaveTaylor</dc:creator>
      <dc:date>2014-05-30T17:46:23Z</dc:date>
    </item>
    <item>
      <title>Re: Zoom to extent working for multi points but not single point</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zoom-to-extent-working-for-multi-points-but-not/m-p/661362#M61735</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This is a limitation with graphicsExtent.&amp;nbsp; You basically have to check for a single point and, if that's the case, use the centerAndZoom function.&amp;nbsp; Look below for a solution:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.arcgis.com/threads/93686-graphicsExtent-and-the-single-point"&gt;http://forums.arcgis.com/threads/93686-graphicsExtent-and-the-single-point&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 May 2014 18:58:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zoom-to-extent-working-for-multi-points-but-not/m-p/661362#M61735</guid>
      <dc:creator>ScottGunn</dc:creator>
      <dc:date>2014-05-30T18:58:16Z</dc:date>
    </item>
    <item>
      <title>Re: Zoom to extent working for multi points but not single point</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zoom-to-extent-working-for-multi-points-but-not/m-p/661363#M61736</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I have a filter by points working so when a user types something into a text box and hits a button it queries the map and zooms them to the queried results. This works fine for multiple points but is not working when the result is just a single point. Below is my code. Thanks in advance!&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;//remove all graphics on the maps graphics layer
&amp;nbsp;&amp;nbsp;&amp;nbsp; map.graphics.clear();
 var extent = esri.graphicsExtent(featureSet.features); 
 map.setExtent(extent.expand(1), true);
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You must create new extent and expand that single point like this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
var newExtent = new esri.geometry.Extent();
newExtent.xmin = YourSinglePointX - 100;
newExtent.ymin = YourSinglePointY - 100;
newExtent.xmax = YourSinglePointX + 100;
newExtent.ymax = YourSinglePointY + 100;
newExtent.spatialReference = map.spatialReference;
map.setExtent(newExtent);

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:58:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/zoom-to-extent-working-for-multi-points-but-not/m-p/661363#M61736</guid>
      <dc:creator>NoppadonHimananto</dc:creator>
      <dc:date>2021-12-12T03:58:59Z</dc:date>
    </item>
  </channel>
</rss>

