user600314
user600314

Reputation: 662

get position of a point along a line defined by 2 points in latitude longitude

Say I have two points: Point1 and Point2

I am currently using Google Maps, but this can be applicable to any language. So my points are defined as: google.maps.LatLng(..)

The two points form a line. Now if I travel X meters along the line from Point1, how can I get the latitude/longitude of this new point.

(The distance between Point1 and Point2 would only ever be a some km)

Any help would be greatly appreciated.

Upvotes: 0

Views: 1664

Answers (1)

TreyA
TreyA

Reputation: 3427

You need to compute the bearing between the two points. Then, with the distance, you can calculate the destination point (lat/lon) based on distance and bearing. See here for formulas: http://www.movable-type.co.uk/scripts/latlong.html

Upvotes: 2

Related Questions