I wrote some code to swap out the basemap layer from a default, USGS layer to a less stable Wisconsin based one. The problem is that the mapview's goTo doesn't work and the map remains zoomed way out. If I used a Wisconsin focused base map as the default then it works, but anything with a national extent fails
This is the code fragment
if (this.basemaps[1].basemapObject.baseLayers.toArray()[0].loadError == null) {
this.mapView.map.basemap = this.basemaps[1].basemapObject;
// remove ESRI default layer
console.log("mapView is ",this.mapView);
this.basemaps.splice(0,1);
this.removeBasemap("USGS");
this.mapView.goTo({
center: this.mapView.center,
zoom: 3
});
}
clearInterval(interval);
}, 10000);
If I check the mapView's zoom property it would be at -1.
What else do I need to do to get this to work?
Alternatively does ESRI have basemap layers for individual states?
What version of the API are you using? I saw a similar problem in 4.23, and it's discussed here.