Geocoder
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
Interactive Geocoding
1. Install OpenLayers module, geocoder module, and the 2.x development snapshot of geofield
2. For your geofield widget select "OpenLayers Map"
3. Select "Enable geocoding of location data" and configure.
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:
<?php
// 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".