Time for Action – interacting with a map
We'll use the map we created in Chapter 1 to do this example, interacting with our OpenLayers map by calling various functions of the map.
Open up the map from Chapter 1 in Firefox. Enable Firebug and the Console panel. If you would like, you can take a look at the Net panel and view the network activity to see the requests your page is making.
Go to the Console panel, input and then execute the following code:
console.log(map);
You should see the map object information come up in the console log. Click on it, and take a moment to look over the various attributes it has. Near the bottom, you can see a list of all the functions that belong to it (which are also referred to as methods).
Take note of the function names, as we'll be using them.
Go back to the Console panel, type in and execute the following code:
map.zoomIn(); map.getExtent();
Take note of the extent. Clear out the code you typed in, then type in the following and execute it:
map.zoomToMaxExtent...