BaseMapToggle widget is different in 4.11...

307
5
Jump to solution
04-04-2019 07:39 AM
Arne_Gelfert
Regular Contributor

Just noticed that the BaseMapToggle widget has properties renamed... found this thanks to the helpful error messages when using Typescript. Used to be for 4.10 as follows...

let basemapToggle = new BasemapToggle({
  view: view,
  secondmap: "satellite"
})‍‍‍‍

Now, it's

let basemapToggle = new BasemapToggle({
  view: view,
  nextBasemap: "satellite"
})‍‍‍‍

Not a big deal but I didn't see that in the Release Notes. Is there a place to note observations like this that may be missing from documentation?

0 Kudos
1 Solution

Accepted Solutions
KellyHutchins
Esri Frequent Contributor

Correct the widget never had either a secondmap or secondBasemap property. I think it just looked like it was working because if the nextBasemap property isn't set a default base map (hybrid) is used. The thumbnail for hybrid looks similar to the one specified in the tutorial (satellite) so it gives the impression that it is working. 

I'll contact the team who built the tutorial and let them know its incorrect. 

View solution in original post

5 Replies
KellyHutchins
Esri Frequent Contributor

The property to select the alternate basemap has always been nextBasemap. We haven't had a property called secondmap. You can see nextBasemap working in this code pen but if you switch to secondmap it will use the default alternate basemap instead of the specified one (national geographic). 

https://codepen.io/kellyhutchins/pen/XQdmBx

The code pen above is pointing to 4.10. 

Arne_Gelfert
Regular Contributor

Okay, I'm confused.... it's quite possible that I got it backward though. This is what I was using before and which seemed to work. (Source: https://developers.arcgis.com/labs/javascript/select-a-basemap/ ) . 

In the main function, create a BasemapToggle widget. Set the view and the secondBasemap property to satellite.

var basemapToggle = new BasemapToggle({     view: view,     secondMap: "satellite"   });

  

Interestingly, the text says 'secondBasemap' and the code 'secondmap'. Both wrong? So are you saying they never existed?  Anyway, like I said, it's working after I changed it to nextBasemap.

0 Kudos
KellyHutchins
Esri Frequent Contributor

Correct the widget never had either a secondmap or secondBasemap property. I think it just looked like it was working because if the nextBasemap property isn't set a default base map (hybrid) is used. The thumbnail for hybrid looks similar to the one specified in the tutorial (satellite) so it gives the impression that it is working. 

I'll contact the team who built the tutorial and let them know its incorrect. 

Arne_Gelfert
Regular Contributor

Thanks, Kelly - now I get it. Either way, I'm glad that by use of Typescript and the jsapi types, I was alerted to this!

KellyHutchins
Esri Frequent Contributor

I agree - this is one of the reasons I love using TypeScript to build apps. 

0 Kudos