salman admission
salman admission

Reputation: 47

how to find in android whether a location is between given two location?

Suppose a person is going from Location A to Location D then suppose if i am going from Location B to Location D, then how to find out in Android using direction api whether my way comes between that person way.

Upvotes: 2

Views: 42

Answers (2)

Mushirih
Mushirih

Reputation: 451

Using distance API (link below) you can calculate 1.distance A to D 2.Then calculate distance from A to B and add distance B to D If difference between 1 and 2 is zero,then its the same route

https://developers.google.com/maps/documentation/distance-matrix/intro

Upvotes: 0

Jack Deeth
Jack Deeth

Reputation: 3357

You have three points: A, B and C. You know how to find the direction between two points.

So, if direction(A to B) is similar to direction(B to C) then B is roughly between A and C. Roughly. This will be less accurate near the poles and over longer distances.

Upvotes: 1

Related Questions