-1

In Google maps api I am writing a calculation script for a taxi company.

The charge per mile, which I have done. However, if the destination is within the Greater London area, the price goes up from £1.50 to £2.50 per mile.

Does anyone know how to calculate the distance travelled within this area?

I understand I can define the area as a polygon, but I don't know how to calculate the distance traveled in that area.

Kara
  • 6,115
  • 16
  • 50
  • 57

2 Answers2

0

Could you calculate the distance of the polyline, using something like this, and then determine whether the polyline passes through your polygon - using something like this - and at what points/distance it crosses, to then determine how much to charge.

Community
  • 1
  • 1
purpletonic
  • 1,858
  • 2
  • 18
  • 29
0

with locatio class there is method that give you the distance between two geo point. location.distance(location2)