Call MapQuest API

Need to call MapQuest Geocoding API and get the distance between 2 locations?
triplebd69Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rose BabuSenior Team ManagerCommented:
Here is the javascript MapQuest API to get the direction

http://developer.mapquest.com/web/documentation/open-sdk/javascript/v7.0/routing#needGeocoding

are you looking for a direction map or the just value between two location?

also here is a webservice for your need

http://www.mapquestapi.com/directions/

this page has all the details about the webservice.

hope this will help you...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
triplebd69Author Commented:
I have looked at this, but calling it via my C# code and parsing the XML is my issue?
0
Rose BabuSenior Team ManagerCommented:
what are all the Common URL Parameters you using in your c# code? is the outFormat xml or json?

can you give me your sample url without key value. also what error you are getting while parsing the response?
0
easynowboyCommented:
Here is some php code that will do the job if that helps?

<?php
      
      
      function distance($lat1, $lon1, $lat2, $lon2, $unit) {
      
        $theta = $lon1 - $lon2;
        $dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) +  cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta));
        $dist = acos($dist);
        $dist = rad2deg($dist);
        $miles = $dist * 60 * 1.1515;
        $unit = strtoupper($unit);
      
        if ($unit == "K") {
          return ($miles * 1.609344);
        }
        else if ($unit == "N") {
            return ($miles * 0.8684);
          }
        else if ($unit == "Y") {
            return ($miles * 1760);
          }
            else {
              return $miles;
            }
      }
      
      echo distance(50.850, -0.75838, 50.850, -0.85838, "M") . " Miles<br>";
      echo intval(distance(50.840, -0.89838, 50.849, -0.89838, "Y")) . " Yards<br>";
      echo distance(53.632293, -0.89838, 53.623393, -0.89838, "K") . " Kilometers<br>";
      echo distance(50.84316, -0.89838, 50.84317, -0.89838, "N") . " Nautical Miles<br>";
      
      ?>
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Services

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.