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

Layers in OpenLayers 3


OpenLayers is a JavaScript library, and as discussed earlier is built using Object Oriented Programming (OOP). When we want to actually create a layer, we will create (or instantiate) an object from an ol.layer.Layer subclass.

OpenLayers has many different ol.layer classes. The layer types are only for different kinds of data (tiles, images, and vector). Using an attached ol.source.* will allow you to connect to a different type of map server 'back end.' Each layer object is independent of other layer objects; so, doing things to one layer won't necessarily affect the other.

Note

How many layers can I have?

The safest maximum amount of layers you can have on a map at one time depends largely on the user's machine (that is, their processing power and memory). Too many layers can also overwhelm users; many popular web maps (for example, Google and Yahoo!) contain just a few layers. We recommend that you don't use a lot of layers or limit the number of layers that you can...