O'Reilly logo

OpenLayers 3 : Beginner's Guide by Erik Hazzard, Paul Spencer, Thomas Gratier

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

Time for action – changing layer properties

Follow these steps to change layer properties:

Use the example derived from the first example from Chapter 1, Getting Started with OpenLayers, also available at chapter04/2360_04_01_changing_layer_properties.html:

<!doctype html> <html lang="en"> <head> <title>Simple example</title> <link rel="stylesheet" href="../assets/ol3/css/ol.css" type="text/css" /> <link rel="stylesheet" href="../assets/css/samples.css" type="text/css" /> </head> <body> <div id="map" class="map"></div> <script src="../assets/ol3/ol.js" ></script> <script> var osmLayer = new ol.layer.Tile({ source: new ol.source.OSM(), opacity: 0.6, brightness: 0.2 }); var view = new ol.View({ center: ol.proj.transform([-1.8118500054456526, 52.4431409750608], ...

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