There are two versions of this module for Drupal 7. When Geocoder 2.x will be stable, the old Geocoder 1.x will be deprecated. The API has changed between those two modules, so please, if you use this module, get ready to update your code.

Warning: Update Instructions from Geocoder 8.x-2.0-alphaX to 8.x-2.0-beta1 (Patch provided)

Geocoder 1.x

This module will geocode just about anything you throw at it including addresses, GPX files, geo-tagged images, and KML files.

It is commonly used to automatically geocode Addressfield addresses into Geofield points for display on Openlayers Maps. It also supports the geolocation, and location modules.

This module also makes available an API to convert the information you already have into geographic information. It support a variety of input formats and runs them through pluggable backends to produce geographic information. In addition to Latitude / Longitude points, this API also supports more complex geographies such as lines and polygons.

If you'd like to help improve the module your patches and co-maintenance are welcome!

Features

  • Geocode Address or location data from any text or Addressfield value (using Google, Yahoo, Yandex, or MapQuest).
  • Read Geotags from EXIF data in your photos.
  • Convert any GPX Tracklog into a Linestring.
  • Convert uploaded KML files into geometries.
  • Convert uploaded or typed GeoJSON and WKT into geometries.
  • Services module integration. You can easily transform Drupal into a general purpose geocoding server using REST, SOAP, XMLRPC etc.

Compatible modules

Installation

All you need to do is install the geoPHP module, which is required by geocoder.

Tutorial

There's a nice video tutorial on using geocoder, addressfield, and geofield here: http://vimeo.com/38558646

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();
dpm($handlers);

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

Geocoder 2.x

This is a complete rewrite of the Geocoder module, based on the Geocoder PHP library - Version 3.x.

Features

  • Solid API based on Geocoder PHP library
  • Geocode and Reverse Geocode using one or multiple Geocoder providers (ArcGISOnline, BingMaps, File, GoogleMaps, Nominatim, OpeneStreetMap, etc);
  • Results can be dumped into multiple formats such as WKT, GeoJson, etc ...
  • The Geocoder Provider and Dumper plugins are extendable through a custom module;
  • Submodule Geocoder Field provides Drupal fields widgets and formatters, with even more options;
  • Geofield and Address field integration;
  • Caching results capabilities, enabled by default;

Requirements for D8

Installation for D8

  1. Download the module running the following shell command from you project root (at the composer.json file level):

    $ composer require "drupal/geocoder"

    Note: this will also download the Geocoder PHP library as vendor/willdurand/geocoder

  2. Enable the module via Drush

    $ drush en geocoder

    or the website back-end/administration interface;

  3. Eventually enable also the submodules: geocoder_field and geocoder_geofield / geocoder_address;

Installation for D7

  1. drush dl composer_manager
  2. drush dl service_container
  3. drush dl composer-8.x-1.x
  4. drush dl geocoder-7.x-2.x
  5. drush en geocoder -y
  6. Eventually enable also the submodules: geocoder_field and geocoder_geofield / geocoder_address

API

Find the documentation on the API in the README.md file.

Modules using Geocoder 2.x

Project information

Downloads