Skip to Main Content
Mapping with Drupal
book

Mapping with Drupal

by Alan Palazzolo, Thomas Turnbull
December 2011
Intermediate to advanced content levelIntermediate to advanced
150 pages
3h 50m
English
O'Reilly Media, Inc.
Content preview from Mapping with Drupal

OpenLayers

The OpenLayers module has been in development for a few years and has a more contemporary architecture and API than the GMap module. There is plenty of documentation around the OpenLayers module in the module’s code and on Drupal.org, but the easiest way to learn the API is to find something in the code that is similar to what you want to do and learn from that by adapting it.

Architecture

The OpenLayers module architecture is more complicated than the GMap module, but the basic structure is still the same as described at the beginning of this chapter: we create a configuration object in PHP; we send the object to the client (web browser) to be processed with JavaScript; and finally the object is rendered by the OpenLayers library. The main difference is that the OpenLayers module separates out aspects of the map creation into Layers, Styles, Behaviors, and Maps, as outlined in Mapping with the OpenLayers Module.

The architecture of the OpenLayers module is based on a widely used Drupal module called CTools. The CTools module provides APIs and tools to do a broad range of things in Drupal more easily, including multistep forms, displaying modal windows, and handling AJAX requests. The most important role that the CTools module plays in OpenLayers is that it allows for plug-ins. CTools plug-ins is an architecture that activates code within other modules so that they carry out extra tasks or interact with one another in various useful ways. Layer Types and Behaviors are examples ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

High Performance Drupal

High Performance Drupal

Jeff Sheltren, Narayan Newton, Nathaniel Catchpole
Using Drupal

Using Drupal

Heather Berry, Angela Byron, James Walker, Jeff Eaton, Nathan Haug, Jeff Robbins

Publisher Resources

ISBN: 9781449311308Errata PageSupplemental Content