Jump to Content

Objective HTML

Geocoder

A configurable and simple server-side geocoder

Problem

So you have a channel of data that has four or five fields to store the address. For example, you have the following fields: address, city, state, and zip. But once that data is entered, there is no way of searching it by location without a latitude and longitude. And once that data is in the system, it's a lot harder to convert it when it should just have a latitude and longitude from the start.

Solution

Geocoder will automatically form the address string based on the settings you define in the control panel. That string will be sent to Google and will be validated. If an invalid location returns, an error will appear in the form. If there is a valid location, the first returned set of coordinates are saved to the define channel fields. The entire Google Maps response can even be saved if you have the fieldtype installed. You can even use it for multiple channels and any set of channel fields.

Overview

Geocoder is a configurable server-side geocoder that extends the Google Maps for Expression API. With Geocoder installed, you can setup any number of channels and fields to geocoder addresses when entries are posted with the control panel, Safecracker, and the channel entries API.


Requirements

Geocoder is an official expansion pack to Google Maps for ExpressionEngine, which extends the Google Maps for ExpressionEngine API, and therefore a valid license for each is required. Geocoder will not work if Google Maps for ExpressionEngine is not installed.

Installation

Uploading the files
Copy the gmap_geocoder module directory to your /system/expressionengine/third_party/ directory.
Copy the gmap_geocoder theme directory to your /themes/third_party/ directory.
Installing the add-on
Go to the Modules page and click install
Choose Install on the Module
Setup - Step 1

Once you have the add-on installed, it's literally minutes away from working. Open on the module control panel and create a new geocoder instance.

Install Step 1
Setup - Step 2

The Geocoder instance is made up of a few fields. You can define as many fields as needed to make up your address string, and you can define multiple channels if needed. The latitude, longitude, and Google Maps fields are optional, but if defined, each will store the appropriate value that is returned by Google.

Install Step 2