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
About the Authors
About the Reviewer

Making use of map permalinks

A great feature when browsing the World Wide Web is the ability to bookmark websites that interest you. These bookmarks offer a way for you to save the link and return to the same content at a later date.

Some web pages contain variables in the URL, which identify the particular content that you're accessing. You can share a copy of the URL with someone else, and they can see exactly what you are seeing too. Of course, we can also apply this convenience to web-mapping applications.

Wouldn't it be nice if we could share the URL (the permalink) of a map so that when it's loaded on someone else's device, the same position on the map can be restored? We can achieve this on the client in the JavaScript code, rather than using logic on the server side to help structure the map loading, which is based on the URL.

To demonstrate this, we'll have a URL with a hash of keys and values (a technique that's common with JavaScript applications). These values will tell us the centre...