Last updated 14 January 2014. Created on 27 March 2012.
Edited by friedjoff, azuledu, ulim. Log in to edit this page.

This module helps to connect Drupal with GeoServer. In conjunction with your spatially enabled Drupal site the GeoServer module has four main tasks:

  • render Drupal content and other geodata as raster maps
  • export data in a variety of vector data formats useful for web maps or as import source for other systems
  • provide OGC webservices
  • build a tile cache for fastest map delivery

It is especially useful in conjunction with the PostGIS module and the OpenLayers module. It is part of the Cartaro distribution.


This module requires PHP's cURL extension to be installed and activated. First you need to install this module like any other Drupal module. In addition you need to setup GeoServer. Make sure GeoServer is able to access the Drupal database if you want to publish data from Drupal using GeoServer. Also you need to add the Drupal administrator credentials to the list of GeoServer users. This is also possible using the GeoServer web administration interface. GeoServer 2.2.4 is recommended but more recent versions should work as well.

For GeoServer version 2.2.5 and above it is necessary to set the JVM startup parameter ENABLE_JSONP=true. Please consult the documentation of your servlet container for instructions. Users of Tomcat 7 on Ubuntu want to append to JAVA_OPTS in /etc/default/tomcat7. Note that despite stated in GeoServer's documentation, only the JVM startup parameter will work for all GeoServer versions.


Finally you need to adapt the session timeout of GeoServer to Drupal. Edit geoserver/WEB-INF/web.xml or [Tomcat]/conf/web.xml and set the following session-config block inside the web-app block. After the Java application server that is running GeoServer is restarted, everything is ready to configure the GeoServer module.


GeoServer Configuration


The GeoServer module will authenticate Drupal users in GeoServer even without web access to it. For GeoServer versions under 2.4.1, additional configuration is necessary. The webLogin Filter Authentication Chain should allow the creation of an HTTP session for storing cookies. To configure this behaviour, in Security → Authentication → Filter Chains click on webLogin and check Allow creation of an HTTP session for storing the authentication token. Be sure to click on save to maintain the new settings in Security → Authentication page.


Data source

The Drupal database is going to be a data source for GeoServer, so should know where to find it. You will have to create the PostGIS datastore manually using the GeoServer web administration interface.

First of all, it is necessary to create a workspace for Drupal layers. In Data » Workspaces click on Add new workspace. Choose a name (e.g. "Drupal") and a unique Namespace URI (e.g. http://drupal).

Let's create now a new store to provide data to GeoServer. In Data » Stores click on Add new Store. Choose PostGIS as the type of data source and set the connection parameters of the Drupal database. Select also the previously created Workspace. After save, a new layer creation wizard appears. It could be ignored as the layers will be created from Drupal through the GeoServer module.


Drupal users should exist in GeoServer to allow authentication. GeoServer user settings can be found in Security » Users, Groups, and Roles » Users/Groups. It is necessary to recreate Drupal users (and passwords) inside GeoServer. It is also possible to use Drupal as a connection provider for GeoServer to share users and roles. The documentation about how to configure it can be found here.

GeoServer Drupal module Settings

The main GeoServer settings can be found at Administration » Structure » GeoServer » Settings. This is where you configure the connection and default parameters.

URL: The URL where GeoServer is running. If GeoServer is running inside Tomcat on the same machine as Drupal, the URL is probably "http://localhost:8080/geoserver". You need to re-login into Drupal to allow authentication to GeoServer before the new server can be used.

Workspace: The default GeoServer workspace. If this list is empty the connection to GeoServer is probably not working.


Go to Administration » Structure » GeoServer » Layers to add new GeoServer layers or update and delete existing layers. Right now only the PostGIS module provides GeoServer layer types.

Layer Settings

General settings for each layer type can be found at Administration » Structure » GeoServer » Layers » Settings. In case of the PostGIS layer type you need to specify the datastore where Drupal stores its data.

Layer Administration

This section describes briefly the administration of layers using the PostGIS layer type as an example. Before you get started make sure a content type with a PostGIS field is available, as described in the PostGIS module documentation. Also a PostGIS datastore with access to the Drupal database needs to be configured in advance (see Layer Settings above).

Go to Administration » Structure » GeoServer » Layers » Settings » Add and select the PostGIS layer type. Enter some basic layer information and proceed to the layer configuration fieldset.

Style: Select a default style for this layer. See below on how to create or update styles.

OpenLayers: This fieldset is only visible if the OpenLayers module is installed. If you enable one of those options a corresponding layer will be available to your OpenLayers administration interface at Administration » Structure » OpenLayers » Layers.

Layer specifics: This is where settings specific to the PostGIS layer type are specified. Usually you only need to select a PostGIS field from the list and all other fields will be configured automatically. Checking those other fields is always a good idea.


The administration interface for GeoServer styles can be found at Administration » Structure » GeoServer » Styles. The administration of styles works mostly like the layer administration (see above). Consult the GeoServer documentation on how to define your own styles.

How to protect your data

If the GeoServer extension to share users and roles with Drupal is installed, the layer permissions can be set directly from Drupal. The details about how to configure this can be found here.

Authentication243.png43.53 KB

Looking for support? Visit the forums, or join #drupal-support in IRC.