basemap changing, webmapId

2083
6
12-10-2014 08:28 AM
Dianede_lanfranchi
New Contributor

Hello everyone,

I'm working on an app which use arcgis online map,

arcgisUtils.createMap(webmapId, "mapDiv").then(function(response) {

                            map = response.map;

And I would like to change the basemap like this sample, after many tries I wonder if it's possible to do it with a webmapId. If it's possible I'd appreciate some tips if possible...

Thanks you vm !

0 Kudos
6 Replies
Dianede_lanfranchi
New Contributor

Anyone ?

0 Kudos
YungKaiChin
Occasional Contributor

Never thought about that. (So I am totally guessing what may work here.)

Have you tried ... ?

1. Put "arcgisUtils.createMap(webmapId, "mapDiv").then(function(response) { map = response.map;}" inside a function that accept webmapId paramter?

2. Create a toggle button to toggle between map id's?

Of course, the potential problem may be that there are more than one base layer/map in the map, but you can find out.

0 Kudos
KellyHutchins
Esri Frequent Contributor

Diane,

The current BasemapToggle widget doesn't support ArcGIS Online web maps. We hope to add support for working with web maps to this widget at a future release. That said it is possible to get this to work by 'hacking' in a fix until widget support is available. I've attached a zip file that includes a code sample showing how to use the Basemap Toggle widget with a web map.

Dianede_lanfranchi
New Contributor

Thanks you for this, I will try to make it work.

EDIT: Made it work so ty vm both of you for your help

0 Kudos
ChrisGuirguis
New Contributor II

Hi Kelly,

Any chance you guys have added built-in support for this yet? 

Thanks,

Chris

0 Kudos
Noah-Sager
Esri Regular Contributor

I think we have what you're looking for at 4x:

https://codepen.io/noash/pen/xxxEqda 

0 Kudos