Book Image

OpenLayers 3.x Cookbook - Second Edition

By : Peter J. Langley, Antonio Santiago Perez
Book Image

OpenLayers 3.x Cookbook - Second Edition

By: Peter J. Langley, Antonio Santiago Perez

Overview of this book

OpenLayers 3 is one of the most important and complete open source JavaScript mapping libraries today. Throughout this book, you will go through recipes that expose various features of OpenLayers 3, allowing you to gain an insight into building complex GIS web applications. You will get to grips with the basics of creating a map with common functionality and quickly advance to more complicated solutions that address modern challenges. You will explore into maps, raster and vector layers, and styling in depth. This book also includes problem solving and how-to recipes for the most common and important tasks.
Table of Contents (14 chapters)
OpenLayers 3.x Cookbook Second Edition
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Preface
Index

Working with projections


As we've learned in previous recipes in this book, OpenLayers has built-in support for the EPSG:4326 and EPSG:3857 projections. Of course, this is very useful, but it is also rather limited when you need to work with other projections worldwide. Offering more built-in projections would add bloat to the library, and transforming between projections is not a simple task.

Instead, OpenLayers outsources this task to other libraries dedicated to transforming projections from one to another. One such library is called Proj4js (http://proj4js.org), which OpenLayers integrates with seamlessly.

So, when we want to work with projections other than EPSG:4326 and EPSG:3857, we look to the help of Proj4js.

Note

Teaching you about projections is outside the scope of this book. The EPSG codes are simply a standardized way to classify and identify a great amount of available projections. EPSG:4326 corresponds to the World Geodetic System (WGS84), and EPSG:3857 is the Spherical Mercator...