Skip to main content

Address to Coordinates

Converts a textual address to geographic coordinates (latitude and longitude) using Google Maps API.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.

Inputs

  • Address - The textual address to convert to coordinates (e.g., "1600 Amphitheatre Parkway, Mountain View, CA").

Options

  • Credentials - Google Maps API key credential used to authenticate with the service.

Output

  • Result - The geocoding result containing latitude and longitude coordinates along with additional address information.

How It Works

The Address to Coordinates node converts a textual address into geographic coordinates using Google Maps Geocoding API. When executed, the node:

  1. Validates the provided address input
  2. Retrieves the Google Maps API key from credentials
  3. Creates a Geocoding request with the provided address
  4. Sends the request to Google Maps Geocoding API
  5. Returns the geocoding result which includes:
    • Latitude and longitude coordinates
    • Formatted address
    • Address components (street, city, state, etc.)
    • Place ID
    • Geometry information

Requirements

  • A valid Google Maps API key with Geocoding API enabled
  • Valid address input

Error Handling

The node will return specific errors in the following cases:

  • Empty or invalid address input
  • Invalid or missing Google Maps API credentials
  • Google Maps API service errors
  • Network connectivity issues

Practical Examples

Example 1: Geocode Single Address

Convert a customer address to coordinates for mapping:

Input:

  • Address: "1600 Amphitheatre Parkway, Mountain View, CA 94043"
  • Credentials: Your Google Maps API key

Output (Result object contains):

{
"geometry": {
"location": {
"lat": 37.4224764,
"lng": -122.0842499
}
},
"formatted_address": "1600 Amphitheatre Parkway, Mountain View, CA 94043, USA",
"place_id": "ChIJ2eUgeAK6j4ARbn5u_wAGqWA"
}

Access coordinates:

  • Latitude: {{result.geometry.location.lat}}
  • Longitude: {{result.geometry.location.lng}}

Example 2: Batch Geocode Addresses from Excel

Geocode multiple addresses from a spreadsheet:

  1. Read Excel - Load addresses from spreadsheet
  2. Loop - Iterate through each address row
  3. Address to Coordinates - Geocode each address
    • Address: {{item.address}}
  4. Set Variable - Store coordinates
    • {{item.latitude}} = {{result.geometry.location.lat}}
    • {{item.longitude}} = {{result.geometry.location.lng}}
  5. Write Excel - Save updated data with coordinates

Example 3: Extract Address Components

Get specific address parts (city, state, zip code):

Input:

  • Address: "Times Square, New York, NY"

Extract components from result:

// Access address components array
{{result.address_components}}

// Find specific component types:
// - locality: city name
// - administrative_area_level_1: state
// - postal_code: zip code
// - country: country name

Example 4: Validate and Standardize Addresses

Clean up inconsistent address formatting:

Input addresses:

  • "broadway and 42nd street nyc"
  • "Broadway & W 42nd St, New York"
  • "Times Square, Manhattan"

Output formatted_address:

  • All return standardized: "Times Square, New York, NY 10036, USA"

Tips for Effective Use

Address Format Best Practices

  • Be Specific: Include street number, city, state/province, and country

    • Good: "123 Main St, Springfield, IL 62701, USA"
    • Okay: "123 Main St, Springfield, IL"
    • Risky: "Main Street, Springfield" (ambiguous - many cities named Springfield)
  • Use Standard Abbreviations: Google accepts common abbreviations

    • Street, St, Avenue, Ave, Boulevard, Blvd are all understood
    • State codes work: CA, NY, TX, etc.

Handling Multiple Results

Some addresses may return multiple results (e.g., "Springfield" exists in many states):

  • The first result {{result[0]}} is usually the most relevant
  • Check {{result.length}} to see how many matches were found
  • For ambiguous addresses, add more detail (city, state, country)

Performance Optimization

  • Cache Results: Store geocoded coordinates to avoid repeated API calls
  • Batch Processing: When geocoding many addresses, add delays to respect rate limits
  • Error Recovery: Use "Continue On Error" and log failed addresses for later retry

Working with Partial Addresses

The geocoder can handle:

  • Landmarks: "Eiffel Tower, Paris"
  • Intersections: "5th Avenue and 34th Street, NYC"
  • Postal Codes: "10001, USA" (returns center of zip code area)
  • Cities: "San Francisco, CA" (returns city center)

Common Errors and Solutions

Error: "ErrInvalidArg: Address cannot be empty"

Cause: The address input is empty or null.

Solution:

  • Check that your address variable contains a value
  • Use a conditional node to skip empty addresses
  • Provide a default address or handle missing data upstream

Error: "ErrCredentials: No Credential Content"

Cause: Google Maps API key is not configured or invalid.

Solution:

  • Verify your credential is created in Robomotion vault
  • Ensure the credential contains your API key in the "value" field
  • Check that the credential is selected in the node's Options

Error: "ErrGoogleMaps: ZERO_RESULTS"

Cause: Google Maps couldn't find any results for the address.

Solution:

  • Verify the address is correct and exists
  • Try a more general address (e.g., just city and state)
  • Check for typos in street names or city names
  • Ensure international addresses include the country name

Error: "ErrGoogleMaps: OVER_QUERY_LIMIT"

Cause: You've exceeded your daily API quota or rate limit.

Solution:

  • Check your usage in Google Cloud Console
  • Increase your quota or upgrade your billing plan
  • Add delays between geocoding requests (use "Delay After" property)
  • Implement caching to reduce duplicate requests

Error: "ErrGoogleMaps: REQUEST_DENIED"

Cause: API key doesn't have Geocoding API enabled or has restrictions.

Solution:

  • Enable Geocoding API in Google Cloud Console for your project
  • Check API key restrictions (HTTP referrer, IP, or API restrictions)
  • Verify billing is enabled on your Google Cloud account

Usage Notes

  • The address should be as specific as possible for accurate results
  • The API key must have Geocoding API permissions enabled
  • The result contains multiple address components that can be parsed as needed
  • Multiple results may be returned for ambiguous addresses
  • The node returns structured data that can be used with other map-related nodes
  • Results include a place_id which uniquely identifies the location
  • Coordinates are provided in WGS84 datum (standard for GPS)