<?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: Pan to polygon - keep current extent in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/pan-to-polygon-keep-current-extent/m-p/287976#M26483</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Got it:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;map.centerAt(polygon.getExtent().getCenter());&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Well, piece of cake, as I said... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 Jul 2011 07:32:54 GMT</pubDate>
    <dc:creator>AxelSchaefer</dc:creator>
    <dc:date>2011-07-14T07:32:54Z</dc:date>
    <item>
      <title>Pan to polygon - keep current extent</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/pan-to-polygon-keep-current-extent/m-p/287975#M26482</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;maybe my question is piece of cake but I don't know a nice solution. I hope you can help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a polygon graphic from a find-result and I want to &lt;/SPAN&gt;&lt;STRONG&gt;pan&lt;/STRONG&gt;&lt;SPAN&gt; to the location. I want to keep the current scale of the map (even if you can hardly see the polygon in the map).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The standard examples shows how to &lt;/SPAN&gt;&lt;STRONG&gt;zoom&lt;/STRONG&gt;&lt;SPAN&gt; to the polygon by&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;map.setExtent(polygon.getExtent());&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This changes the current scale of the map to the scale where the polygon fits.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to keep the current scale. My solution right now changes the scale afterwards to the previous scale. Like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
var scale = esri.geometry.getScale(map);
map.setExtent(currentItem.geometry.getExtent());

// Wait until the extent change has completed
var tempHook = dojo.connect(map, "onUpdateEnd", function() {
&amp;nbsp; map.setExtent(esri.geometry.getExtentForScale(map, scale));
&amp;nbsp; // Dispose of the temporary listener
&amp;nbsp; dojo.disconnect(tempHook);
});
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The disadvantage is: I have to create a temp-hook waiting for the map-update of my first zoom to the polygon. After that I change the extent back to the previous one (var scale). Two map requests and responses. And it looks grumpy because the map changes two times (zoom-in, zoom-out).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a way to "pan" to the polygon directly? I don't know why I can't find it. There must be a way, I guess...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Axel&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jul 2011 07:16:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/pan-to-polygon-keep-current-extent/m-p/287975#M26482</guid>
      <dc:creator>AxelSchaefer</dc:creator>
      <dc:date>2011-07-14T07:16:59Z</dc:date>
    </item>
    <item>
      <title>Re: Pan to polygon - keep current extent</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/pan-to-polygon-keep-current-extent/m-p/287976#M26483</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Got it:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;map.centerAt(polygon.getExtent().getCenter());&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Well, piece of cake, as I said... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jul 2011 07:32:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/pan-to-polygon-keep-current-extent/m-p/287976#M26483</guid>
      <dc:creator>AxelSchaefer</dc:creator>
      <dc:date>2011-07-14T07:32:54Z</dc:date>
    </item>
  </channel>
</rss>

