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.
Flow Data Explained
action required string
The geo-coding operation the stubmation should perform.
For this use case the value must be:
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:
Address from Comma Separated LatLng String
Use this when latitude and longitude are provided as a single comma separated string.
Flow Data Explained
action required string
The geo-coding operation the stubmation should perform.
For this use case the value must be:
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:
Address from Separate Lat and Lng String Values
Use this when latitude and longitude are provided as separate string values.
Flow Data Explained
action required string
The geo-coding operation the stubmation should perform.
For this use case the value must be:
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:
action_params.lng required string
The longitude value as a string.
Example:
Address from Separate Lat and Lng Numeric Values
Use this when latitude and longitude are provided separately and should be sent as numeric values.
Flow Data Explained
action required string
The geo-coding operation the stubmation should perform.
For this use case the value must be:
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:
action_params.lng required number
The longitude value as a number.
Example:
Summary of Supported Payloads
The geo-location stubmation currently supports these payload shapes.
Address to Co-ordinates
Co-ordinates to Address using latlng
Co-ordinates to Address using string lat and lng
Co-ordinates to Address using numeric lat and lng
Notes
- Use
co-ords_from_addresswhen starting with a normal address - Use
address_from_co-ordswhen 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