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

Delimiting tiles in a raster layer

To show how easy it is to change the appearance of an element using CSS, in this recipe we are going to add a border to all the tiles from any raster layer to show where the limits of each tile are:

Delimiting tiles in a raster layer

How to do it...

  1. Create an HTML file with OpenLayers dependencies and add within the head section a style element with the following CSS code:
    <style>
        .olTileImage {
            border: 1px solid #999;
        }
    </style>
  2. Next, in the body element of the document, add the div element to hold the map:
    <div id="ch06_tile_borders" style="width: 100%; height: 90%;"></div>
  3. Now, add the following JavaScript code to initialize the map and add a base ...

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