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

OpenLayers projection class


So far, we've been talking about the abstract idea of a projection. Let's dive into OpenLayer's ol.proj namespace functions and the associated class ol.proj.Projection class, which is what we use to actually handle projections. The ol.proj.Projection class relies on internal code, managing the most used projection in the web mapping world: the EPSG:4326 projection (also named WGS 84) and the EPSG:3857 projection, also known as EPSG:900913 (using leetspeak, it means Google, the first company relying on this exact projection), and also, alternatively named WGS 84 Spherical Mercator. For reference, you can have the full history of the second projection at http://wiki.openstreetmap.org/wiki/EPSG:3857

For other use case such as custom projections, OpenLayers, for convenience, supports an external library called Proj4js, which can be found at http://proj4js.org. First, we'll talk about what we can do without the Proj4js library, and then talk about what we can do with...