The Map class is, as you have probably realized by now, the core piece behind your map. The map object(s) you create is the most important thing behind your map, as without a map object you can't do anything with layers or controls. In this chapter, we'll talk about the Map class, which we've been taking for granted so far.
We will also introduce the concept of a view, which is used to change what we see in a map, and several core concepts you'll need to understand the rest of this book.
We used the Map and View classes so far in this book, without really understanding what's going on. This chapter aims to not only explain how and why we've been doing things, but will also provide thorough coverage of two core classes—the Map and View classes. Specifically, we'll look at:
Map class isMap class relates to the other classes we've discussedMap classView class to change the location displayed by the mapThe OpenLayers' Map class is the core component of OpenLayers. We use it to manage the layers, controls, interactions, and overlays. We've worked with it already by creating a map object, adding layers to it, then using its view to modify its extent. We are yet to discuss the functionality behind the Map class, the core component of our applications.
In OpenLayers, everything belongs to the Map class. The Layer, Control, and Interaction classes must be hooked up to a map if we want them to do anything. So, we need a map object to actually create a useful map—and as you might imagine, we'll see later in this chapter that it is possible to make an application that uses multiple map objects.