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

Improving Chrome and Developer Tools with extensions


Although it's more related to programming than web mapping, it's recommended to increase your abilities at using web debuggers.

Chrome DevTools by default offers the main functions to develop and debug with OpenLayers, but to be more efficient, it's really required to use extensions. Extensions are additions to Chrome browser or to the Developer Tools to add or augment default software functions. You can find most of them at http://www.google.com/intl/en/chrome/webstore/extensions.html.

We'll review some of them.

JSONView

Usually you're consuming web services providing JSON (JavaScript Object Notation) when you're doing mashups. To illustrate why the add-on is useful, we will use a geocoder service, such as Nominatim, to retrieve position for a postal code. A geocoder is a tool to match addresses with geographic coordinates.

For example, typing http://nominatim.openstreetmap.org/search?q=35+Livery+Street+Birmingham&format=json&limit=1 in Chrome will send you the following screenshot:

With the extension, you will directly get an indented content, collapsible.

So what is the difference? When it's required to correctly reuse data, we must understand received data and with this plugin, the return content is human readable! Furthermore, OpenLayers can consume GeoJSON, a subset JSON notation dedicated to maps data.

Download it at https://chrome.google.com/webstore/detail/jsonview/chklaanhfefbnpoihckbnefhakgolnmc.

Dealing with color with ColorZilla

When you are making a custom UI, you always have to try different colors.

You can also retrieve a color you like from another website or an image. In this situation, you will not want to always go back and forth between a graphic tool such as Gimp or Photoshop and your browser. So in this case, you can install ColorZilla. How is this related to OpenLayers? When you want to make customize controls elements, this is an invaluable tool. Go to http://www.colorzilla.com/chrome/ to retrieve it. It's also a plugin available for Firefox.

Tip

If you really want to improve your skills for using Chrome Developer Tools, you should visit Code School tutorial at https://www.codeschool.com/courses/discover-devtools. Use also the videos available in the official documentation at https://developers.google.com/chrome-developer-tools/docs/videos.

Visit the Secrets of the Browser Developer Tools website, http://devtoolsecrets.com. It covers all browsers!