Last updated 28 February 2017. Created on 11 March 2011.
Edited by dbjpanda, dbt102, exior, dhwani.addweb. Log in to edit this page.

Geofield is a Drupal 7 module that provides a field type for storing geographic data. This data can be attached to any entity, e.g., nodes, users and taxonomy terms. Geofield provides different widgets for data input and formatters for data output. It integrates with other mapping modules (including OpenLayers 2 and Geocoder),

The Geofield module can store data as Latitude and Longitude, Bounding Box and Well Known Text (WKT) and it supports all types of geographical data: points, lines, polygons, multitypes etcetera.


Install and enable the Geofield module and its required module geoPHP in the usual way. Learn more about installing Drupal modules.

Sample code for Composer based installs

Add the following to your composer.json file. Obviously the full block is only required if you don't have a require-dev block.

"require-dev": {
   		 "drupal/geofield": "8.*"

The run $composer drupal-update //warning: this updates everything. Backup first...

Add a geofield to content

You can add geographical information to an entity (content type, user, taxonomy term or comment) by adding a geofield.

To add a geofield to e.g., a "Basic Page" go to /admin/structure/types/manage/page/fields/

Add a new field of the field type "Geofield", and choose the preferred widget, e.g., "OpenLayers Map". Configure the field according to the chosen options.

Display geographical information

Geofield Map

Geofield comes with the basic but easy-to-use submodule Geofield Map that allows you to display geographical data in a Google map.


For more advanced and flexible data display you need to create and configure a map in OpenLayers 2.

If you use OpenLayers you need to enable the OpenLayers UI. After, you can set Geofield Formatter Map output as default map in /admin/structure/openlayers/. Choose "Geofield Formatter Map" in the field OpenLayers Default Map.

You can easily create your own map by cloning an existing one. Introduction to OpenLayers.
When you have configured a map in OpenLayers you must define to use the map for displaying data at /admin/structure/types/manage/page/display/.


Geofield integrates also with the lightweight map display tool Leaflet

Microdata &

Geofield supports microdata, which can be used by scripts and search engines to extract the Geo information in a meaningful way.

When you have Microdata module enabled, you can configure your microdata output on the field configuration page. There are suggestions of appropriate settings at the bottom of the form. Choose one and click "Use suggested mapping".

More info

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