<?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 How to reload existing map and view? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-reload-existing-map-and-view/m-p/474488#M44015</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi im currently using the API and react to build a site which houses a map as its primary page.&amp;nbsp; The map loads fine with all of its layers, however i currently have logic that allows me to "hide" the map div for other elements to show.&amp;nbsp; I want to be able to reselect my map from the navigation bar I have setup and reload my old map.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At the moment the map does not display when i try to reshow the div containing the map.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;return (&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;div&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{ this.state.showMap === true &amp;amp;&amp;amp; ref={this.mapViewReference }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;...&lt;/P&gt;&lt;P&gt;&amp;lt;/div&amp;gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The data for the old map still exists with all of its layers etc i just want to be able to reload the map.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 12 Jun 2020 21:50:21 GMT</pubDate>
    <dc:creator>ChristianKempis</dc:creator>
    <dc:date>2020-06-12T21:50:21Z</dc:date>
    <item>
      <title>How to reload existing map and view?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-reload-existing-map-and-view/m-p/474488#M44015</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi im currently using the API and react to build a site which houses a map as its primary page.&amp;nbsp; The map loads fine with all of its layers, however i currently have logic that allows me to "hide" the map div for other elements to show.&amp;nbsp; I want to be able to reselect my map from the navigation bar I have setup and reload my old map.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At the moment the map does not display when i try to reshow the div containing the map.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;return (&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;div&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{ this.state.showMap === true &amp;amp;&amp;amp; ref={this.mapViewReference }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;...&lt;/P&gt;&lt;P&gt;&amp;lt;/div&amp;gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The data for the old map still exists with all of its layers etc i just want to be able to reload the map.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jun 2020 21:50:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-reload-existing-map-and-view/m-p/474488#M44015</guid>
      <dc:creator>ChristianKempis</dc:creator>
      <dc:date>2020-06-12T21:50:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to reload existing map and view?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-reload-existing-map-and-view/m-p/474489#M44016</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So i was able to come out with a solution however i feel this is a very hacky work around to a feature that arcgis should have by default.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had to essentially take the object holding my previous map state and copy all of it into a new map with initialization.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;const reloadMap (domElementRef) =&amp;gt; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;let oldMap = Object.assign({}, mapObject)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;const map = new Map({&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;basemap: oldMap.basemap,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;layers: oldMap.mapView.map.layers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;})&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;const view = new MapView({&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;container:&amp;nbsp;domElementRef,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;map: map&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;})&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Code similar to above allows the map to completely reload.&amp;nbsp; Note:&amp;nbsp; you will have to readd ui elements again as attempting to directely copy ui elements from the old object does not work.&amp;nbsp; If anyone has a better solution im open to suggestions&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 13 Jun 2020 00:33:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-reload-existing-map-and-view/m-p/474489#M44016</guid>
      <dc:creator>ChristianKempis</dc:creator>
      <dc:date>2020-06-13T00:33:47Z</dc:date>
    </item>
  </channel>
</rss>

