Maps and Views in ArcGIS JS API
Maps are dumb
One big change for developers to realize when using the latest EsriJS beta is that maps don’t do very much. If you look at the docs, you’ll see that a map is simply a container for data. It essentially just manages layers. It’s not even in charge of how things are drawn, that task is left up to the View. If you want to render information in 2D, you would use a MapView, or you can render the same map in 3D using a SceneView. So really, the map is just a container of information, it’s up to you do decide how you want to shine the light on it.
Embrace your Views
If you look at the events of a Map, all you get is stuff related to the layers. You don’t even get a load o ready event, but this has more to do with promises in the API and Accessors than anything else. But look at the methods and properties for the map. There is nothing for navigation or refreshing the map. All these types of operations are now handled in the Views.
So let’s say you had a single map and you wanted to display that map in both 2D and 3D… well it’s very simple.
You can see a demo this here. 3D/2D map - 4.0 beta 1 on jsbin.com
See, one map, multiple views. You could even take advantage of the Accessors in the API to do some other cool stuff, like a ghetto overview map.
In this case, you are watching for the center to change in one view and sync it to another. You can see a demo of this here. 3D/2D map - 4.0 beta 1 on jsbin.com
Maps and Views and Lions, Oh My
Ok, so there’s no lions in the API, but I think you get the basic idea that Views are the workers in the Map-to-View relationship. The map is the keeper of the data, the views are the canvas you stick it on or the globe you drape it over. Once you get used to this simple concept in the API, I’m pretty sure you’ll be able to go out there and make some awesome applications! Remember, the map is your box of goodies, the views are your looking glass.