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.

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

  • Geofield (recommended location storage)
  • Addressfield (recommended address storage)
  • Core Image and File modules (for images and uploaded files - KML, GPX etc.)
  • Core Text fields (alternative address storage)
  • location (alternative location or address storage)
  • geolocation (alternative location storage)
  • geocoder-autocomplete Provides a nice auto-complete text-widget. (Doesn't use geocoder api)
  • Computed Field

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

Development version released the 16th of January.

This is a complete rewrite of the code, based on the Geocoder PHP library.

Features

  • Solid API based on Geocoder PHP library
  • Geocode and Reverse Geocode using one or multiple providers (list)
  • Results can be dumped into multiple formats (list)
  • Submodule Geocoder Field: provides Drupal fields widgets and formatters, with even more options.
  • Submodule Geocoder Services: provides a Geocoding and reverse geocoding service through the contrib module Services.
  • File geocoding, Addressfield integration, caching enabled by default.

Requirements

Installation

  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

Have a look at the log of the installation on my computer.

Warning: I only use drush to install modules, documentation on how to install without it is to be done.

API

Find the documentation on the API in the README file.

Modules using Geocoder 2.x

Project Information

Downloads