You are using a browser that is no longer supported. Please use the latest version of Google Chrome, Mozilla Firefox, Apple Safari, or Microsoft Edge. For more information please see the System Requirements.
Skip To ContentArcGIS for DevelopersSign In Dashboard

Unsupported browser

You are using a browser that is not supported. JavaScript API works on the latest versions of Google Chrome, Mozilla Firefox, Apple Safari, or Microsoft Edge. Use one of these browsers and provide your feedback through GeoNet, the Esri Community.

  • {}
  • Firefox
  • Safari
  • undefined

Note: Support for 3D on mobile devices may vary, view the system requirements for more information.

This sample demonstrates how to initialize multiple WebMaps from Portal for ArcGIS items. You can then swap the active webmap inside a single view.

This sample uses the following web maps:

  • Missing Migrants - shows all of the missing migrant reports from the International Organization for Migration (IOM). The bright blue symbols represent reports submitted in 2015 or later while the dark blue symbolizes incidents before 2015. The larger symbols represent greater number of reported deaths.
  • Refugee Routes - shows refugee routes into Europe.
  • 2015 European Sea Arrivals - shows arrivals in southern Europe of refugees by sea, January through July 2015.

First, create an array of WebMaps without loading them.

var webmaps = {
  return new WebMap({
    portalItem: {
      id: webmapid

Then based on an action, such as a button click, you can swap the map by referencing the new web map in the view object.

var webmap = webmaps[id]; = webmap;

Please refer to the Working with the ArcGIS Platform for information on how the ArcGIS API for JavaScript makes use of working with portal items.

Sample search results