1. Stubmation
  2. Geo-Coding with Google

Stubmation

Geo-Coding with Google

Uses the `geo-location` stubmation to convert addresses to co-ordinates and co-ordinates to addresses

This stubmation workflow enables the user to perform geocoding and reverse geocoding using a single stubmation named geo-location.

Uses

A scenario for this could be:

  • You have a street address and need to retrieve latitude and longitude
  • You have latitude and longitude and need to retrieve a formatted address
  • You have co-ordinates in different formats and want a standard way to process them through one workflow

This stubmation supports all of those patterns.

What Happens behind the scenes

The stubmation receives a flow_data object that tells it which geo-coding action to perform.

The action key inside flow_data determines the mode of operation.

The action_params object contains the actual values to use for the lookup.

Depending on the action used, the workflow will either:

  • geocode an address into co-ordinates
  • reverse geocode co-ordinates into an address

All template actions built for this workflow call the same stubmation name:

geo-location

The only difference between them is the flow_data.action value and the structure of flow_data.action_params.

Co-ordinates from Address

Use this when you have a full address string and need latitude and longitude.

loading...

Flow Data Explained

action
required
string

The geo-coding operation the stubmation should perform.

For this use case the value must be:

editor
        "co-ords_from_address";

      

action_params
required
json object

Contains the data required for the selected action.


action_params.address
required
string

The full address string to geocode.

Example:

editor
        "14 Jeffrey Str, Ceres, South africa";

      

Address from Comma Separated LatLng String

Use this when latitude and longitude are provided as a single comma separated string.

loading...

Flow Data Explained

action
required
string

The geo-coding operation the stubmation should perform.

For this use case the value must be:

editor
        "address_from_co-ords";

      

action_params
required
json object

Contains the data required for the selected action.


action_params.latlng
required
string

A comma separated latitude and longitude string.

Example:

editor
        "-34.09589404298037, 18.844642396822415";

      

Address from Separate Lat and Lng String Values

Use this when latitude and longitude are provided as separate string values.

loading...

Flow Data Explained

action
required
string

The geo-coding operation the stubmation should perform.

For this use case the value must be:

editor
        "address_from_co-ords";

      

action_params
required
json object

Contains the data required for the selected action.


action_params.lat
required
string

The latitude value as a string.

Example:

editor
        "-34.09589404298037";

      

action_params.lng
required
string

The longitude value as a string.

Example:

editor
        "18.844642396822415";

      

Address from Separate Lat and Lng Numeric Values

Use this when latitude and longitude are provided separately and should be sent as numeric values.

loading...

Flow Data Explained

action
required
string

The geo-coding operation the stubmation should perform.

For this use case the value must be:

editor
        "address_from_co-ords";

      

action_params
required
json object

Contains the data required for the selected action.


action_params.lat
required
number

The latitude value as a number.

Example:

editor
        -34.09589404298037;

      

action_params.lng
required
number

The longitude value as a number.

Example:

editor
        18.844642396822415;

      

Summary of Supported Payloads

The geo-location stubmation currently supports these payload shapes.

Address to Co-ordinates

loading...

Co-ordinates to Address using latlng

loading...

Co-ordinates to Address using string lat and lng

loading...

Co-ordinates to Address using numeric lat and lng

loading...

Notes

  • Use co-ords_from_address when starting with a normal address
  • Use address_from_co-ords when starting with latitude and longitude
  • Use the string variants when the downstream process expects string values
  • Use the numeric variant when the downstream process expects true numbers