2
votes

There is a function in google maps geometry library

interpolate(from:LatLng, to:LatLng, fraction:number)

which finds a point between two other points:

A--X--B

I need something very similar, find a point further along the line:

A--B--X

Interpolate does not accept fraction>1 so I cannot use it. Is there some simple way to calculate the point? I want to achieve given distance between A and X points.

EDIT: In my application the distance was really small so I used fromLatLngToPoint conversion and linear interpolation, which get good enough results on small area.

1
If you know the distance beyond point b then all you need is the bearing from point a to point b and add on the extra distance to return the coords.Rafe

1 Answers

3
votes

You can calculate bearing, then find destination point with code from this excellent page