I need help I have the following 2 points on the map point A lat1/long1 and point B lat2/long2 in google map I have distance, arrived_time, bearingradians and speed.
With these data how can I get a estimated latitude longitude (google map format) to the next point on 10 minutes,20,30 and 40 minutes ?, having start and end point.
Point A lat1=37.78472 lon1=-122.39913
Point B lat2=37.78240 lon2=-121.23208
bearingradians=270
distance=102 KM
arrive_time=50 minutes
speed =122 KM/H
example: http://hmarina.sytes.net/mapagoogle.jpg
What I need you to calculate the nexts points, I going to use PHP, or where should I start
Thank you
There are multiple ways to calculate this. Some of them are quite complex.
You could use Vincenty's formula, which is often used for bearing and distance calculations. The formula needs Long/Lat of the starting point, the bearing and a distance. I doubt, that you want to reimplement this algo, so here you go: Implementing Vincenty's Formula in PHP
Another solution could be to use vectors to calculate the destination points along a great-circle given distance and bearing from start point. This approach might be a bit easier, then to work with spherical trigonometry. http://www.movable-type.co.uk/scripts/latlong-vectors.html and https://stackoverflow.com/a/1739066/1163786
Another one is to calculate the intermediate points on a great-circle. http://williams.best.vwh.net/avform.htm#Intermediate
Let's use Vincenty here and re-calc your end-point, given a starting-point, bearing and distance:
lat1=37.78472
; lon1=-122.39913
;approx. 89
102 km
Result: Latitude: 37°47′42″N
37.79506902
, Longitude: 121°14′28″W
-121.24119021
That is pretty close your Point B.
Now, you want to determine the future position (lang/lat) by calculating the distance you will travel based on your current speed and your known time interval. In other words, your next point is 10 minutes from the starting point given speed 122 km/h and 89 bearing.
Calculate new distance: 122 km/h = 2033.33 m/min
, so in 10 minutes: 20333.33 m = 20,333 km approx
.
You new data for the formula:
lat1=37.78472
; lon1=-122.39913
;approx. 89
20,333 km
And re-run vincenty with these values to get Lat/Long...
This might be of help: