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 – playing with various sources and layers together

To achieve your task, combine our knowledge and just follow these instructions:

  1. Let's make a map mashup that consists of a different tiles layer, a WMS layer. We will also play with the visibility to display a basic layer switcher.
  2. First, we need to reuse the usual template that call OpenLayers 3 CSS and JavaScript for our code and put it on a local server:
    <!doctype html> <html lang="en"> <head> <title>Playing with various sources and layers </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> ...

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