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