Book Image

OpenLayers 2.10 Beginner's Guide

Book Image

OpenLayers 2.10 Beginner's Guide

Overview of this book

Table of Contents (18 chapters)
OpenLayers 2.10
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Doing stuff with events


In Chapter 6, we introduced the notion of events and how OpenLayers uses events. At the core, there are essentially two types of events used by OpenLayers: Browser events and Map events. Browser events are things like clicking on the map div with your mouse, while Map events are things such as zooming the map to some coordinate. We worked a little bit with events in Chapter 6, so let's extend that knowledge and add even more custom functionality to our map.

Note

We won't go over browser events much, but the ideas behind them are essentially the same as map events. A great resource to find out more about browser events can be found at https://developer.mozilla.org/en/DOM/event.

Map event types

There are a number of supported map event types. Let's take a look at them, and then we'll cover how to use them in your map. You can also call map.EVENT_TYPES, which will return an array of valid map events. Some event types will return an event object to the event listener. If...