Book Image

OpenLayers 3: Beginner's Guide

By : Thomas Gratier, Paul Spencer, Erik Hazzard
Book Image

OpenLayers 3: Beginner's Guide

By: Thomas Gratier, Paul Spencer, Erik Hazzard

Overview of this book

<p>This book is a practical, hands-on guide that provides you with all the information you need to get started with mapping using the OpenLayers 3 library.</p> <p>The book starts off by showing you how to create a simple map. Through the course of the book, we will review each component needed to make a map in OpenLayers 3, and you will end up with a full-fledged web map application. You will learn the key role of each OpenLayers 3 component in making a map, and important mapping principles such as projections and layers. You will create your own data files and connect to backend servers for mapping. A key part of this book will also be dedicated to building a mapping application for mobile devices and its specific components.</p>
Table of Contents (22 chapters)
OpenLayers 3 Beginner's Guide
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – creating a separate build


Unlike before, we don't need to move our application code into a separate file. Unless you kept a copy of the application from before the previous example, however, we'll need to fix up our HTML file a little bit for this example. This example assumes you are starting with the previous example:

  1. Create a copy of flickr_combined.js and call it flickr_separate.js. As always, you may use a different name but make sure it is consistent! You might also want to make a copy of your HTML file and use it for the rest of this example.

  2. Edit flickr_separate.js and remove all the goog.require statements from the beginning of the file.

  3. Add a new <script> tag to load flickr_separate.js after the <script> tag that loads the combined build file:

    <script src="flickr_separate.js"></script>
  4. Now, we need to create our custom build of OpenLayers. First, we'll need a configuration file. Let's create a new file named flickr_separate.json in the OpenLayers...