Click here to Skip to main content
15,860,861 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hii ..
i have latitude and longitude of source and destination..now how to find direction among them..

i already tried with following function ,which shows the direction by address ...

C#
function calcRoute() {

       var start = document.getElementById('startvalue').value;
       var end = document.getElementById('endvalue').value;
       var request = {
           origin: start,
           destination: end,
           travelMode: google.maps.DirectionsTravelMode.DRIVING
       };
       directionsService.route(request, function (response, status) {
           if (status == google.maps.DirectionsStatus.OK) {
               directionsDisplay.setDirections(response);
           }
       });

   }





but i want to find direction by latitude and longitude of that source and destination..please suggest me some modification in this function...

thank u...
Posted

The Vincenty's formulae will help you. Please start from here: http://en.wikipedia.org/wiki/Vincenty%27s_formulae[^].

—SA
 
Share this answer
 
Actually the Great Circle formulas will give a good approximation, you don't need to use the Vincenty formula unless you are doing extremely precise stuff (need directions in decimal degrees over great distances).
 
Share this answer
 
Comments
Ron Beyer 23-Apr-13 23:54pm    
http://www.movable-type.co.uk/scripts/latlong.html

Scroll down and there are script examples, they are in Java but easy to convert.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900