# Class: Geocoder

## Geocoder

WPGMZA.Geocoder

#### new Geocoder()

  Base class for geocoders. Please do not call this constructor directly. Always use createInstance rather than instantiating this class directly. Using createInstance allows this class to be externally extensible.
  See:
    - WPGMZA.Geocoder.createInstance

### Members

#### <static, constant> FAIL

  Indicates the geocode failed, usually due to technical reasons (eg connectivity)

#### <static, constant> SUCCESS

  Indicates a successful geocode, with one or more results

#### <static, constant> ZERO_RESULTS

  Indicates the geocode was successful, but returned no results

### Methods

#### <static> createInstance()

  Creates an instance of a Geocoder, please always use this function rather than calling the constructor directly

  ##### Returns:

  A subclass of WPGMZA.Geocoder
  Type
    WPGMZA.Geocoder

#### <static> getConstructor()

  Returns the contructor to be used by createInstance, depending on the selected maps engine.

  ##### Returns:

  The appropriate contructor
  Type
    function

#### geocode(options)

  Geocodes either an address or a latitude and longitude coordinate pair, depending on the input

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `options` | object | The options to geocode, you must supply either latLng or address.

  ##### Throws:

  You must supply either a latLng or address

  ##### Returns:

  Type
    void

#### getAddressFromLatLng(options, callback)

  Attempts to convert latitud eand longitude coordinates into a street address. By default this will simply return the coordinates wrapped in an array.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `options` | object | The options to geocode, latLng is mandatory.
  `callback` | function | The callback to receive the geocode result.

  ##### Returns:

  Type
    void

#### getLatLngFromAddress(options, callback)

  Attempts to convert a street address to an array of potential coordinates that match the address, which are passed to a callback. If the address is interpreted as a latitude and longitude coordinate pair, the callback is immediately fired.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `options` | object | The options to geocode, address is mandatory.
  `callback` | function | The callback to receive the geocode result.

  ##### Returns:

  Type
    void

#### Search results