14
Views
1
Comments
[Google Distance Matrix API] Google Distance Matrix API setup assistance
Question
google-distance-matrix-api
Service icon
Forge asset by www.justsolve.co.za
Application Type
Service

Hi,

I have installed the Google Distance Matrix API from the forge. Setup a REST API to connect to Google Maps (maps.googleapis.com). I have the API keys and have successfully used them with the Maps and Get Directions.

I just can't figure out how to configure the Distance Matrix API settings to get it to work correctly.

What is the relationship between “Google Distance Matrix" forge component and the REST consumer?

Looking for help with the REST settings and the Action Logic.


Hope that makes sense and you can help.

Thanks,

Glenn


2025-09-28 15-31-59
Claudio Barra

Hi Glenn,

I can help you get the Google Distance Matrix API working in OutSystems! Let me break down the relationship and configuration for you.

Understanding the Relationship

The Google Distance Matrix forge component typically provides a wrapper/abstraction layer that makes it easier to call the Google Distance Matrix API. However, you can also call it directly using a REST consumer.

Here's how they relate:

  • Forge Component: Pre-built logic that handles the REST calls for you (easier but less flexible)
  • REST Consumer: Direct integration where you configure the API calls yourself (more control)

This is the link to the documentation:
Distance Matrix API


For the REST API configuration:

  • Base URL: https://maps.googleapis.com/maps/api/distancematrix
  • Method: GET
  • URL Path: /json

Input Parameters (all as Query Parameters):

  • origins (Text) - Origin addresses or lat/lng coordinates
  • destinations (Text) - Destination addresses or lat/lng coordinates
  • key (Text) - Your API key
  • mode (Text, Optional) - driving, walking, bicycling, transit
  • units (Text, Optional) - metric or imperial
  • departure_time (Text, Optional) - For transit/traffic
  • avoid (Text, Optional) - tolls, highways, ferries

Example:
https://maps.googleapis.com/maps/api/distancematrix/json?origins=San+Francisco&destinations=Los+Angeles&key=YOUR_API_KEY


I will provide you a small OML so you can see a implementation of this API

GoogleDistanceMatrix.oml
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.