Distance between two locations

179 views
Skip to first unread message

Mohammad Farfour

unread,
Nov 28, 2019, 5:23:08 PM11/28/19
to MIT App Inventor Forum
hello i am developing an android application that calculated the road distance between two points not direct distance.To do this i must use google api but i searched on google and i found several services that give a free api.
So how to use these api's in my project and is there any free api you can recommend to me.
Thank you by advance 

SteveJG

unread,
Nov 28, 2019, 6:29:29 PM11/28/19
to mitappinv...@googlegroups.com
What is useful depends on how you intend to use the api.  (how to use these api's in my project ) -- we have no idea what your projects is supposed to do, do we Mohammad?

* Google Distance Matrix api is the best for determining driving distance between two points and providing directions.   It is 'free' for a limited amount of api usage, there after Google charges.  Great for personal use.

* Use the ActivityStarter to use Google Navigate.  This is free 


Instead of placing an address in the Text block, place a destination lat/lon pair and it will calculate the driving distance and route between the Android and that destination.


*  OpenStreetMaps provides free distance/route information.       HOW TO use the new Map Control. plot a route and post driving distance and time describes how to use it.  It is a  'free' service however excessive usage will get charged.    Please have a look at the API Usage Policy before you use it.         Or do something similar using the OSM web site  and App Inventor   OpenStreetMap without the Map Component                      
This one might is  free  https://www.distance24.org/api.xhtml      Use the Web component to produce a json file using an url like http://www.distance24.org/route.json?stops=Hamburg|Berlin where your two locations are separated by  |   .

*  You might be able to use MapQuest Open Directions API Web Service  offers a limited number of transactions free per month.


*   https://www.graphhopper.com/   is NOT free

What else have you found? I am not aware of other  'api's'  ... there are plenty of distance calculators but not api's I am aware of.

Regards,
Steve

Message has been deleted
Message has been deleted
Message has been deleted

Mohammad Farfour

unread,
Nov 28, 2019, 7:47:53 PM11/28/19
to MIT App Inventor Forum
Dear steve,
Thank you very much for this perfect answer , my app is like a tracking application where i want to upload to a firebase the time needed to the car to arrive from this location to this location i don't need the route what it is important for me is the actual time of the routing through the roads so what the way from these you advice me to start with?
It is my first time to deal with API thats why i am bit confused
This project is a university project and not using that for buisness wise.
Thank you again for the straight forward answer.

Mohammad Farfour

unread,
Nov 29, 2019, 6:02:08 AM11/29/19
to MIT App Inventor Forum
In this post HOW TO use the new Map Control. plot a route and post driving distance and time we built the aia file and i downloaded the apk and it worked perfectly. I have some questions, is this application working on openstreetmaps api that you provided, did you add to the application this api, also does api stop working after a period of time after working on it excessively because it is a free api? Sorry for the unclear questions i am trying to make it as clear as i can, Thank you.

SteveJG

unread,
Nov 29, 2019, 8:43:03 AM11/29/19
to MIT App Inventor Forum
Very glad the tutorial worked well for you Mohammad.

Yes, the example uses MIT Map control; the control uses OpenStreetMaps.     Does the api stop working after a period of time after working on it excessively?   Probably.  Read this ling   https://operations.osmfoundation.org/policies/tiles/   The maps are free, use of the tile servers is limited.

Excessive usage and ...

zzzosmOverusage.PNG


You probably should read     Introduction to OSM for Business Users - OpenStreetMap Wiki so you  understand what happens if you have lots of users of your app.







ABG

unread,
Nov 29, 2019, 10:53:29 AM11/29/19
to MIT App Inventor Forum
(added to Maps section of FAQ)
ABG

Reply all
Reply to author
Forward
0 new messages