The Map class
OpenLayers' Map class is what drives our maps. All the things we'd like to do with our maps—moving them, zooming, adding layers—all these things are made possible by this class. We've worked extensively with it already by creating a map object, adding controls and layers to it, then telling the map to zoom to the max extent. While we've covered Layers and Controls in pretty good detail, we have yet to really discuss the functionality behind the Map class, the core component of our applications.
In OpenLayers, control and layer objects belong to a map object. Control and layer objects must be hooked up to a map if we want them to do anything. So, we need a map object to actually make a useful map—and as you might imagine, we'll see later in the chapter that it is possible to make an application that uses multiple map objects.
Creating a map object
Before we jump in, let's review the base code for instantiating a map object. We've done this many times before, but a little review...