1

I have two Addresses let say Location A and Location B. And I have series of location between those Location A and Location B. I get those series of locations via Fused location API. and saved them on the server. Now following are my requirements :

What I want: I want to calculate the distance between the Location A and Location B. Right Now I am using a code (link of post here) but it is giving me displacement.

Problems and Confusions:

  • I know about Google Distance matrix API and Google Directions api, but I really do not want to work on these apis as these are costly to me. But if I use them, I really did not understand that how API will know the route user selected. I mean it is possible that User has adopted the long way towards his destination. And I think google Direction and Distance API are returning the distance between Location A and Loation B using shortest route.

I really do not want to use the API, but if there is non other possible way to do that then How could I get that ? and what is best for me. Please suggest me the solution.

Android teem
  • 780
  • 2
  • 13
  • 36
  • 1
    What has the distance between A and B to do with the way the user moved from A to B? – greenapps Oct 19 '17 at 10:55
  • i didnt understood what are you asking ? – Android teem Oct 19 '17 at 10:56
  • 1
    A and B are at a distance of three km. The user travels from A to B and walks six km. What does the distance of A to B have to do with how much a user walks? – greenapps Oct 19 '17 at 10:58
  • mmmm let me explain, let say there are Location A and B . and there are possible routes to them let suppose , route x = 5 km , route y = 8 km and route z 12 km, now user is going on route y. and I am getting his location at regular intervals until he arrives at location B. now I should get his distance as * km but when I did it with Distance and Direction API , it always returns me 5 Km distance. as it is shortest. – Android teem Oct 19 '17 at 11:04
  • I want to get the real distance of the route user drove or walked on. so as you said how much user walked (we can say it) – Android teem Oct 19 '17 at 11:05
  • Well then edit your post as distance of A to B has nothing to do with the length of a track. – greenapps Oct 19 '17 at 11:06
  • what should I call it then ? – Android teem Oct 19 '17 at 11:07
  • I already told you in my last comment. – greenapps Oct 19 '17 at 11:08

1 Answers1

0

I think you have just idea of your logic but you do not know what it is called. Though it is too late but I am posting for your information or in case of if someone later on visit here.

To draw lines between two points on Map,Use Polylines and polygons. To read further I will refer you to this google page, It has a breif introduction and also a source code. And it is even really easy to implement. Here you go.

A.s.ALI
  • 1,992
  • 3
  • 22
  • 54