This is part 2 of our OpenLayers post. Take a look at part 1 for a list of the modules used and to see how to setup OpenLayers on your site and how to display a map on a node using GeoField.

We'll be using the contenttype location created in part 1.

We've used Views 7.x-3.x-dev, since Views 7.x-3.3 gave some errors (

OpenLayers Data Overlay display

OpenLayers Data Overlay

First we'll need to create an OpenLayers Data Overlay display in views. This is a views plugin that pulls the required data from the nodes.

It's also on this display that we'll add our filters, arguments, .. to alter the data that we want to be displayed on our map.

Create a new view without a display.

Add an OpenLayers Data Overlay display.

Geo field

And add the Geo field.


Set the Format to OpenLayers Data Overlay and map the Data Source to the Geo field (WKT).

Your view settings now look like this.

Save your view.

OpenLayers map settings

Configure a map

Again we'll need to configure a map, like we did in part 1 for the maps on our nodes.

Go to Structure > OpenLayers > Maps (admin/structure/openlayers/maps) and add a new map. Use theBasics settings as show: You can change the width/height settings to match your layout.

Layers & styles

Keep the default Center & Bounds settings.

Use the Layers & Styles settings as shown: 

Save your settings before continuing to the Behaviours settings.

Set the Behaviours settings like we did in Part 1, but this time select the OpenLayers Data Overlay layer as the layer to zoom to.

OpenLayers map configuration

The display that shows the map

Make sure you only set these views settings for this display and that you don't change the default settings.

We'll return to our view and create a page display to show the map, based on the settings defined in theOpenLayers Data Overlay display.

You could also create a block if you want the block to be displayed in a block.

Set the Format to OpenLayers Map and select the OpenLayers map configuration we created above.

Map views

Now your view will show you the map.

You might get a Google Map Data overlay.
This is discussed here: