<?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: Linking Two Map Extents in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/linking-two-map-extents/m-p/504009#M46801</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello Manish,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Great work !!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Even useful for me too !!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks a lot !!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hi Ganesh,&lt;BR /&gt;&lt;BR /&gt;I tried to attach the extent change event for both the maps but in that case the maps keep changing the extent and goes in infinite loop. I may have to play around with it for a while. I can certainly update once I get some thing solid.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Manish Patel&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 14 Feb 2014 08:46:15 GMT</pubDate>
    <dc:creator>SunilPalkar</dc:creator>
    <dc:date>2014-02-14T08:46:15Z</dc:date>
    <item>
      <title>Linking Two Map Extents</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/linking-two-map-extents/m-p/504003#M46795</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am trying to link two map extents so that when Map1 extent changes, so does Map2... and vice-versa. I've been using the extent-change event for both Map1 and Map2, but get stuck in an cycle.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I pan Map1, the Map1 extent-change event is fired. This changes Map2 extent, which fires extentChange2 event, which changes Map1 extent... and the cycle continues. Any ideas? Here is the code for reference:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;Map1.on("extent-change", extentChange1);
Map2.on("extent-change", extentChange2);

function extentChange1(evt){
&amp;nbsp;&amp;nbsp;&amp;nbsp; Map2.setExtent(evt.extent);
}

function extentChange2(evt){
&amp;nbsp;&amp;nbsp;&amp;nbsp; Map1.setExtent(evt.extent);
}&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Feb 2014 22:03:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/linking-two-map-extents/m-p/504003#M46795</guid>
      <dc:creator>JosephSaltenberger</dc:creator>
      <dc:date>2014-02-13T22:03:42Z</dc:date>
    </item>
    <item>
      <title>Re: Linking Two Map Extents</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/linking-two-map-extents/m-p/504004#M46796</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Maybe compare the extents before actually changing the extent? If they are the same, end the function.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Feb 2014 22:17:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/linking-two-map-extents/m-p/504004#M46796</guid>
      <dc:creator>SteveCole</dc:creator>
      <dc:date>2014-02-13T22:17:36Z</dc:date>
    </item>
    <item>
      <title>Re: Linking Two Map Extents</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/linking-two-map-extents/m-p/504005#M46797</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I tried that, but I think since the maps are slightly different sizes, the extents are never exactly the same.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I guess one possibility would be to check if the extents are close to each other, rather than exactly the same.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Feb 2014 22:43:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/linking-two-map-extents/m-p/504005#M46797</guid>
      <dc:creator>JosephSaltenberger</dc:creator>
      <dc:date>2014-02-13T22:43:38Z</dc:date>
    </item>
    <item>
      <title>Re: Linking Two Map Extents</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/linking-two-map-extents/m-p/504006#M46798</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Joesph,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Based on the description what I understand is that you have two maps and if extent for either of the map is changed(map1 or map2) the same extent is supposed to be set to the other map.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope I understand it correctly. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please find the below fiddle and let me know if that's what you are looking for:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://jsfiddle.net/patelmanya/uER7L/6/"&gt;http://jsfiddle.net/patelmanya/uER7L/6/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; map.on("extent-change", extentChange1);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;//if you use the below as well then the map will keep going in infinite loop.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //map2.on("extent-change", extentChange2);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.on("zoom-end", extentChange1);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; map2.on("zoom-end", extentChange2);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; function extentChange1(evt) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map2.setExtent(evt.extent);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; function extentChange2(evt) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.setExtent(evt.extent);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Manish Patel&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Feb 2014 04:55:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/linking-two-map-extents/m-p/504006#M46798</guid>
      <dc:creator>ManishkumarPatel</dc:creator>
      <dc:date>2014-02-14T04:55:55Z</dc:date>
    </item>
    <item>
      <title>Re: Linking Two Map Extents</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/linking-two-map-extents/m-p/504007#M46799</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hi Joesph,&lt;BR /&gt;&lt;BR /&gt;Based on the description what I understand is that you have two maps and if extent for either of the map is changed(map1 or map2) the same extent is supposed to be set to the other map.&lt;BR /&gt;&lt;BR /&gt;Hope I understand it correctly. &lt;BR /&gt;&lt;BR /&gt;Please find the below fiddle and let me know if that's what you are looking for:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://jsfiddle.net/patelmanya/uER7L/6/"&gt;http://jsfiddle.net/patelmanya/uER7L/6/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt; map.on("extent-change", extentChange1);&lt;BR /&gt;//if you use the below as well then the map will keep going in infinite loop.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //map2.on("extent-change", extentChange2);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.on("zoom-end", extentChange1);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; map2.on("zoom-end", extentChange2);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; function extentChange1(evt) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map2.setExtent(evt.extent);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; function extentChange2(evt) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.setExtent(evt.extent);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&lt;BR /&gt;Hope this helps.&lt;BR /&gt;&lt;BR /&gt;Best Regards,&lt;BR /&gt;Manish Patel&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Manish &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Really nice functionality. One thing, I noticed on your fiddle is that, If you change extent of the first web map on the top of the page and the second map moves relative to that. But, if you move the second map on the bottom, the map on the top doesn't move relative to this. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any solution?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Ganesh&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Feb 2014 07:46:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/linking-two-map-extents/m-p/504007#M46799</guid>
      <dc:creator>GaneshSolai_Sambandam</dc:creator>
      <dc:date>2014-02-14T07:46:46Z</dc:date>
    </item>
    <item>
      <title>Re: Linking Two Map Extents</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/linking-two-map-extents/m-p/504008#M46800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Ganesh,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried to attach the extent change event for both the maps but in that case the maps keep changing the extent and goes in infinite loop. I may have to play around with it for a while. I can certainly update once I get some thing solid.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Manish Patel&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Feb 2014 08:39:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/linking-two-map-extents/m-p/504008#M46800</guid>
      <dc:creator>ManishkumarPatel</dc:creator>
      <dc:date>2014-02-14T08:39:47Z</dc:date>
    </item>
    <item>
      <title>Re: Linking Two Map Extents</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/linking-two-map-extents/m-p/504009#M46801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello Manish,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Great work !!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Even useful for me too !!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks a lot !!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hi Ganesh,&lt;BR /&gt;&lt;BR /&gt;I tried to attach the extent change event for both the maps but in that case the maps keep changing the extent and goes in infinite loop. I may have to play around with it for a while. I can certainly update once I get some thing solid.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Manish Patel&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Feb 2014 08:46:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/linking-two-map-extents/m-p/504009#M46801</guid>
      <dc:creator>SunilPalkar</dc:creator>
      <dc:date>2014-02-14T08:46:15Z</dc:date>
    </item>
    <item>
      <title>Re: Linking Two Map Extents</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/linking-two-map-extents/m-p/504010#M46802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Sunil,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Glad to help!!! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Manish&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Feb 2014 09:05:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/linking-two-map-extents/m-p/504010#M46802</guid>
      <dc:creator>ManishkumarPatel</dc:creator>
      <dc:date>2014-02-14T09:05:32Z</dc:date>
    </item>
  </channel>
</rss>

