Last updated 25 February 2017. Created on 29 November 2011.
Edited by marco.b, BicycleBob, idevit, batigolix. Log in to edit this page.

Geocoder is a Drupal 7 module that will extract (geocode) geographical data from just about anything you throw at it such as addresses, GPX files, Geotags from EXIF data in photos, and KML files.

A convenient way to allow users to enter an address and have it automatically geocoded is to use it in combination with the Addressfield and Geofield modules.

Geocoder uses the external geocoding services from Google, Yahoo and Yandex.

Don't confuse the Geocode and Geocoder modules. Geocode is only available for Drupal 6.


Install and enable the Geocoder module and its required modules geoPHP and Chaos tool suite in the usual way. Install and enable the optional modules Addressfield and Geofield.
Learn more about installing Drupal modules.


Assign the necessary permissions at /admin/people/permissions#module-geocoder

If you have enabled the modules Addressfield and Geofield you can start using Geocoder in a content type, e.g., an event.

Add a new address field by going to /admin/structure/types, choosing the desired content type and opening the "Manage fields" tab. Add a "Postal address" field and configure the field. Add a geofield and select "Geocode from another field" as widget. In the settings for the geofield you can now choose the source field to geocode from. You can also choose which geocoding service (Google et cetera) to use and configure these services.

Now you have a place where Geocoder can store its result (geofield) and the input to the geocode operation (addressfield). You can then use OpenLayers to map the geofields.

Note: you can use Geocoder in any entity such as a user, a taxonomy term or a comment.

Geocoder API

In addition to the GUI-based widget, geocoder also provides a nice general API for doing geocoding. Here's an example:

// Geocode an address
$address = '4925 Gair Ave, Terrace, BC';
$point = geocoder('google',$address);
$geoJSON = $point->out('json');

// List all available handlers
$handlers = geocoder_handler_info();

New geocoder handlers as easy to define. Simply create a new ctools plugin of the type "geocoder_handler".

More information

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