OpenLayers Plus

OpenLayers is a powerful mapping framework that allows you to create beautiful maps in a short amount of time. Recently, we have been working on an OpenLayers map for a client that requested "density circles," or a way to visually show concentration of projects within a region. I remembered Alan Palazzolo mentioning a project called "OpenLayers Plus" during his session at BadCamp back in the fall.

When I looked into Development Seed's OpenLayers Plus GitHub project I noticed that it was designed for Drupal 6, and this site was Drupal 7. After some help from Scott, I was able to use density circles on our map. Turns out, we only needed to change a few things to get it working in Drupal 7. Here are some step-by-step instruction on how to get OpenLayers Plus working in Drupal 7 (assumes you have already built your OpenLayers data layer with a view):

  1. Download the OpenLayers Plus module
  2. Change the .info file to use Drupal 7 as the core (core = "7.x")
  3. Enclosed all JavaScript functions with the ($) wrapper (we only made this update in openlayers_plus_behavior_scalepoints.js because that is the one behavior we wanted to use)
  4. Make sure your OpenLayers map is pointed to the correct OpenLayers data view under "Layers & Styles" in the OpenLayers module config.
  5. Make sure to check the new options you want under the "Behaviors" tab in the OpenLayers module config. They should be prefaced by "OL +"

Our view was using aggregation to count the number of projects per region. That value was served in the OpenLayers data view under a field called "nid." This is the value we entered for "Field" under the "OL + Scalepoints" options. You can find our source code in our sandbox project.

The end product shows density circles for each region:

* OpenLayers icon taken from

Code Drupal Drupal Planet JavaScript

Read This Next