Esri / public-information-map-template-js

An ArcGIS Online mapping template to showcase social media on a map for disaster response and public information.
http://esri.github.io/public-information-map-template-js/
Apache License 2.0
69 stars 51 forks source link

Strange behaviour of BasemapToggle with defaultBasemap in some cases #51

Open sverkerEsriSE opened 6 years ago

sverkerEsriSE commented 6 years ago

When setting the defaultBasemap option to something other than the basemap that the underlying web map uses, the app will first show the web maps basemap. When the user then does a basemap toggle, it will show the basemap set as the toggle option. On the next toggle, the app will then show the basemap specified as defaultBasemap.

Or to be more clear:

  1. Create a new Web Map in ArcGIS Portal or AGOL
  2. Use Streets as the basemap
  3. Share as Public Information app
  4. Configure public information app to use the Topographic map as Default Basemap
  5. And the National Geographic map as next Basemap.
  6. When the app loads, it will display the Streets basemap
  7. First click on Toggle will display the National Geographic basemap
  8. Next click on Toggle will display the Topographic basemap.

I believe the end user expects the Basemap Toggle to always toggle between the same two maps. So either show the basemap set as Default Basemap when the application loads, irregardless of which basemap was used in the web map, or toggle between the "Next basemap" and the basemap that was used on the web map.

It seems like the BasemapToggle dijit code actually should fetch the map's current basemap when toggling, and put that as previous basemap (and default basemap), but for some reasons, it works the way described above.

driskull commented 6 years ago

Yes this is a known limitation in 3x. The BasemapToggle only recognizes string named basemaps. Basemaps that are set by a webmap or basemap gallery are not recognized.

sverkerEsriSE commented 6 years ago

Thanks for clarifying this!