Drupal and OpenLayers

We've Gone Beta! An In-Depth Look at the Drupal OpenLayers Module

We have just released the first beta of the Drupal OpenLayers module. It's been a pretty crazy adventure as to how we got here, and there are still high hopes for the future. This post is going to be a long one, and should give you the complete introduction to this new mapping module for Drupal, and will also build on and borrow from my previous post on building this module.

What is OpenLayers?

OpenLayers is a free, open-source Javascript library that provides an easy interface to bring together any sort of map tiles, markers, features, and other GIS goodness. OpenLayers was initially developed by MetaCarta; it is now a project of the Open Source Geospatial Foundation. Think Google Maps but open-source. The OpenLayers has many examples and a gallery of sites.

Where Drupal Fits In

Drupal is a great content management system and development framework. OpenLayers fits well into this because it basically is a really great visualization tool for content (the most obvious visualization being maps). Drupal can provide the ability to create and management data/content and OpenLayers can be a fun vehicle to displaying that content and provide a rich interface for your users.

Main Features and Modules

The Drupal OpenLayers module is actually a full suite of modules that provide many integration points with other contributed modules.

  • At is core, the OpenLayers API module provides just enough to take a map array in PHP and render it through hooks, pass it to javascript where it can interact with events, and display a working map to the page. The main API module also manages the basics of map presets.
  • The OpenLayers Preset User Interface module provides a web based interface to manage presets. Presets are basically just named map arrays that are either stored in code or in the database. With presets it becomes easy to provide interfaces to pick maps.
  • OpenLayers Layers modules provides a wide range of layers to use outside the simple default, like Yahoo, Google, OpenStreetMap tiles, and more. Layers can be manually put into map arrays, but with hooks, other modules can provided named layers that get put together when the map is rendered.
  • Much like the layers module, the OpenLayers Behaviors module provides a set of behavior add-ons that can easily be added to map arrays. These include things like feature controls, fullscreen controls, popups, and tooltips.
  • On the input side, there is the OpenLayers CCK module which provides integration with OpenLayers and CCK. This module provides a field and widget for basic WKT input, as well as a widget for the Geo module; both of which allow the user to use a map to enter features like points, lines, and polygons. On the formatter side, you can display any preset map for the field.
  • A simple way to display a map is to use the OpenLayers Filter module, which provides an input format filter where a user can input [openlayers preset_name] into the body content of a node and it will be rendered as that map.
  • Finally, there is a Views plugin provided by the OpenLayers Views module that allows the user to aggregate all kinds of Drupal data and put it into a map.

read more