Distance Matrix

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



this is really gonna help me. thank u so much

1 Like

If you need help finding your coordinates

Use this website: GPS Coordinates

Without graphical interface:


Using GoogleMaps API

If you want Reverse Geocoding




nice tutorial, is there an aia file so we can try it??

Thanks but the links do not load on page ( scripts.kodular.io redirected you too many times.).

Any progress with enabling the link?

Well…If you want to calculate distance between two places then I have something for you.

Or if you don’t want to use extension then:


The response includes the distance and duration between the specified origins and destinations.

I need the calculation of the distance and the duration of the route by car. not only the distance between two points. the script is perfect to do it, because otherwise I would have to do it directly with the google api

Then we have to wait for Kodular Staffs’ reply.

Can u share some aia? Coz some links are not working anymore.