Sponsored Links

Book Review: OpenLayers Cookbook PDF Print E-mail
Written by Richard Marsden   
Thursday, 27 September 2012 09:07

The OpenLayers CookBook by Antonio Santiago Perez is a good description of the more sophisticated functionality support by the OpenLayers open source library.

 

 


"OpenLayers Cookbook" is Packt's second book about OpenLayers and provides more advanced material to accompany the tutorial OpenLayers 2.10 Beginner's Guide. The book is formatted as a series of 60 'recipes' that demonstrate how to perform various tasks. Each recipe follows the Packt house style and is divided into an Introduction (i.e. the objective of the recipe), "Getting Ready", "How to do it", "How it works...", "There's more...", and "See also". As with similar books, the "How it works" and "There's more" sections contain the real content and provide the most insight. This particular volume also adds the "See also" which cross-references similar recipes in the same book.

The recipes are divided into eight chapters:

  1. Web Mapping Basics (basic tutorial subjects, layers, map controls, zooming, panning)
  2. Adding Raster Layers (Google Maps, Bing, WMS, date line issues, layer opacity, buffering, tile issues)
  3. Working with Vector Layers (GML, KML, creating features, WKT, markers, popups, WFS, clustering)
  4. Working with Events (side-by-side map comparator, work in progress indicator, layer events)
  5. Adding Controls (adding, removing, navigation history, placing controls outside the map, modifying and measuring features, getting information from WMS)
  6. Theming (themes, img & theme folders)
  7. Styling Features (symbolizers, StyleMap, styles, custom rules, styled clusters)
  8. Beyond the Basics (projections, OpenLayers.Request, custom controls and renderers, line intersections, animations)


The first chapter starts things off with a very simple guide. This enables the book to work as a tutorial in addition to a cookbook, although this is only recommended if you are already familiar with HTML, CSS, and JavaScript. As it is a quick introduction, the first chapter does use some concepts without explaining them immediately. For example, a reader who is new to web mapping may find he/she using WMS in chapter 1, but they have to be patient and wait until chapter 2 before they learn what WMS actually is!

The book also uses Dojo in a number of the recipes. I have not used Dojo before but I am familiar with OpenLayers, so I was able to follow these recipes. Someone who is new to both OpenLayers and Dojo should probably invest in a tutorial for Dojo as well. If this book is anything to go by, it does look like it makes interactive OpenLayers easier to use, so I may well invest in such a book myself.

The later recipes cover some useful topics (e.g. the side-by-side map comparator) and advanced topics (e.g. projections, WFS, renderers), and potential gotchas (e.g. the need for server-side data proxies). These strike me as a useful complement to the various examples on the official OpenLayers website. These examples cover much of the basic and intermediate level functionality, but they do not cover the advanced functions. Similarly, the OpenLayers source code can be examined to understand some of the more basic functions and properties, but only serves to indicate the existence of the more advanced functionality. The more advanced recipes in this book (e.g. the renderers and custom rules) demonstrate and describe how to use these advanced functions. This should lead to wider use of OpenLayers' more advanced and sophisticated features.

This review is based on the electronic edition of the book. I examined both the PDF and Kindle ('mobi') formats. Unfortunately the Kindle format has a number of formatting problems. Information boxes have cosmetic spacing problems and are missing their guide icons ("Warnings" and "Tips and Tricks"). More seriously, the source code has lost all tabulation. This can make it difficult to read.

The PDF format follows the formatting and style used by Packt for their print editions. This does not suffer from any of these issues. I would recommend buyers of the electronic edition to use the PDF format, and to avoid the Kindle format. The book is also available in the ePub format, which I did not examine.

Summarizing, this book is recommended for users of OpenLayers who intend to use it beyond the most basic "simple map" applications. It should prove useful when implementing slightly non-standard features (e.g. custom controls) as well as implementing the more sophisticated and poorly documented functionality. Avoid the Kindle 'mobi' format.


Last Updated on Thursday, 27 September 2012 09:30