Accessor: services/GeoCoder

services/GeoCoder

Retrieve a location given an address. The location is given as an object with two numeric fields, "latitude" and "longitude". For example, {"latitude": 37.85, "longitude": -122.26} is the location of Berkeley, California.

This accessor requires a "key" for the Google Geocoding API, which you can obtain for free at https://developers.google.com/maps/documentation/geocoding/intro .

This accessor looks for key in $KEYSTORE/geoCoderKey, which resolves to $HOME/.ptKeystore/geoCoderKey.

This accessor does not block waiting for the response, but if any additional address input is received before a pending request has received a response or timed out, then the new request will be queued and sent out only after the pending request has completed. This strategy ensures that outputs are produced in the same order as the input requests.

Version:
  • $$Id$$
Author:
  • Edward A. Lee
Source:
Inputs:
Name Type Description
address string The address, for example "Berkeley, CA".
Outputs:
Name Type Description
location The location, as an object with a 'latitude' and 'longitude' property.
response An object containing the location information.

Methods

(static) filterResponse()

Filter the response, extracting the latitude and longitude and formatting.

Source:

(static) setup()

Set up the accessor by defining the inputs and outputs.

Source: