Book Image

Mastering OpenLayers 3

By : Gábor Farkas
Book Image

Mastering OpenLayers 3

By: Gábor Farkas

Overview of this book

OpenLayers 3 allows you to create stunning web mapping and WebGIS applications. It uses modern, cutting edge browser technologies. It is written with Closure Library, enabling you to build browser-independent applications without painful debugging ceremonies, which even have some limited fallback options for older browsers. With this guide, you will be introduced to the world of advanced web mapping and WebGIS. First, you will be introduced to the advanced features and functionalities available in OpenLayers 3. Next, you will be taken through the key points of creating custom applications with OpenLayers 3. You will then learn how to create the web mapping application of yours (or your company's) dream with this open source, expense-free, yet very powerful library. We’ll also show you how to make amazing looking thematic maps and create great effects with canvas manipulation. By the end of this book, you will have a strong command of web mapping and will be well on your way to creating amazing applications using OpenLayers 3.
Table of Contents (17 chapters)
Mastering OpenLayers 3
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Before getting started


Take a look at the code provided with the book. You should see a js folder in which the required libraries are stored. For the first few chapters, ol.js, and ol.css in the ol3-3.11.0 folder will be sufficient. The code is also available on GitHub. You can download a copy from the following URL: https://github.com/GaborFarkas/mastering_openlayers3/releases. Take a look at the following screenshot:

Note

You can download the latest release of OpenLayers 3 from its GitHub repository at https://github.com/openlayers/ol3/releases. For now, grabbing the distribution version (v3.11.0-dist.zip) should be enough.

Creating a working environment

There is a security restriction in front end development, called Cross Origin Resource Sharing (CORS). By default, this restriction prevents the application from grabbing content from a different domain. On top of that, some browsers disallow reaching content from the hard drive when a web page is opened from the file system. To prevent this behavior, please make sure you possess one of the following:

  • A running web server (highly recommended)

  • Firefox web browser with security.fileuri.strict_origin_policy set to false (you can reach flags in Firefox by opening about:config from the address bar)

  • Google Chrome web browser started with the --disable-web-security parameter (make sure you have closed every other instance of Chrome before disabling security)

  • Safari web browser with Disable Local File Restrictions (in the Develop menu, which can be enabled in the Advanced tab of Preferences)

Tip

You can easily create a web server if you have Python 2 with SimpleHTTPServer, or if you have Python 3 with http.server. For basic tutorials, you can consult the appropriate Python documentation pages.