Distance Matrix

(Diego Barreiro Pérez) #1

Google Maps Distance Matrix

For AppInventor & Makeroid Apps


This script will allow you to get the travel distance between two points using Google Maps Matrix Distance API.
It allows you to setup all GoogleMaps Trave parameters, like transport method or departure time.

How to use it

To use the script, you will need to setup a WebComponent in your AppInventor project, and disable SaveResponse checkbox and leave blank the URL
Then, in blocks screen, init a variable called base_url with the value https://scripts.makeroid.io/distance-matrix/ - (http://scripts.makeroid.io/distance-matrix/)
And then, you can setup parameters to that variable using the block join(Text) like ?distance-matrix to customize the script

Customization Parameters

With those params you can use this script, but continue reading if you want more customization. So, a basic usage example would be: http://scripts.makeroid.io/distance-matrix/?distance_matrix&origin&a_lat=42.8265457&a_lon=-8.6052464&destination&z_lat=42.8389455&z_lon=-8.5833596

You can join all of this parameters (except some of them that have already been already marked)

Handle response

Use it yourself

Use your own API Key

Add this parameter to use your own API Key: &custom_key=
eg.: https://scripts.makeroid.io/distance-matrix/?distance_matrix&custom_key=your_matrix_key

You can request one here:
Google Maps -> Distance Matrix API -> Google Developers Console

Source Code

SourceCode is avaliable on GitHub:
Distance Matrix


(David Ningthoujam) #2

this is really gonna help me. thank u so much

(Diego Barreiro Pérez) #3

If you need help finding your coordinates

Use this website: GPS Coordinates

Without graphical interface:


Using GoogleMaps API

If you want Reverse Geocoding