Book Image

OpenLayers 3.x Cookbook - Second Edition

By : Peter J. Langley, Antonio Santiago Perez
Book Image

OpenLayers 3.x Cookbook - Second Edition

By: Peter J. Langley, Antonio Santiago Perez

Overview of this book

OpenLayers 3 is one of the most important and complete open source JavaScript mapping libraries today. Throughout this book, you will go through recipes that expose various features of OpenLayers 3, allowing you to gain an insight into building complex GIS web applications. You will get to grips with the basics of creating a map with common functionality and quickly advance to more complicated solutions that address modern challenges. You will explore into maps, raster and vector layers, and styling in depth. This book also includes problem solving and how-to recipes for the most common and important tasks.
Table of Contents (14 chapters)
OpenLayers 3.x Cookbook Second Edition
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Preface
Index

Modifying layer appearance


We already saw how to perform some basic layer appearance modifications in the Changing layer opacity recipe in Chapter 2, Adding Raster Layers. We also saw how to reorder the layer stack and show or hide layers. This kind of layer modification may be sufficient for the majority of web-mapping applications, but we're going to take a look at some other more advanced techniques for this recipe.

During this recipe, we will modify the appearance of the raster tiles that are returned from the tile service. As we know, raster tiles are returned as images, which means that we can manipulate the color of the images when they're applied through the canvas renderer.

Color manipulation can also be performed on the server (perhaps a proxy server) before returning the modified tiles to the browser. Alternatively, if you're in control of the tile service itself, you could offer the raster tiles in a different color scheme.

We, of course, will look at how this can be achieved in...