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

Starting actions outside the controls

Another different and drastic way to change the look of our applications is to place the controls outside the map and attach them to our own components.

Most of the OpenLayers controls have two features:

  • They realize some action (edit features, create a line, and so on)
  • They know how to render themselves on top of the map

To achieve the goal of this recipe, the idea is to separate the visualization from the action that the control does. This way, we can create some buttons and activate or deactivate a control depending on the button that is pressed:

Starting actions outside the controls

As we can see in the screenshot, we are going to create a toolbar ...

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