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

Working with popups

A common charecteristic of web mapping applications is the ability to show information related to the features the map contains. By feature we mean any real phenomenon or aspect we can visually represent with points, lines, polygons, and so on.

Of course we can select a feature, retrieve its associated information and show it anywhere in our application layout, but the most common way to show it is by using popups.

Working with popups

How to do it...

  1. Create an HTML file with OpenLayers dependencies. Then add the div element to hold the map:
    <div id="ch3_popups" style="width: 100%; height: 100%;"></div>
  2. Within the JavaScript section, initialize the map ...

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