O'Reilly logo

OpenLayers Cookbook by Antonio Santiago Perez

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 4. Working with Events

In this chapter we will cover:

  • Creating a side-by-side map comparator
  • Implementing a work in progress indicator for map layers
  • Listening for vector layer features' events
  • Listening for non-OpenLayers events

Introduction

This chapter is focused on events, which is an important concept in any JavaScript program. Although this chapter is brief, the concepts explained here are very important to understand when working with OpenLayers.

Events are the heart of JavaScript. They are the impulses that allow us to produce a reaction. As programmers of a mapping application, we are interested in reacting when the map zoom changes, when a layer is loaded, or when a feature is added to a layer. Every class susceptible to emit events ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required