title: calculate the road distance from source latitude and longitude to destination
body: <p>I have used the following code but this gives me the air distance from source to destination, but i require road distance, please help me guys with this.</p>
  
  <p>This work but this air distance but i require street/road distance.</p>
  
  <pre><code>$center_lat =$_POST['lat'];
  
  //19.159519;//
  $center_lng =$_POST['lng'];//72.995782;//
  $radius = '3963.0';
  $range=$_POST['range'];
  //echo $center_lng;
  // Set the active mySQL database
  $db_selected = mysql_select_db("mapdb", $connection);
  
  // Search the rows in the markers table
  $query = sprintf("SELECT name,lat, lng, ( 3959 * acos( cos( radians('%s') ) * cos( radians( lat ) ) * cos( radians( lng ) - radians('%s') ) + sin( radians('%s') ) * sin( radians( lat ) ) ) ) AS distance FROM hospitals HAVING distance &lt; '%s' ORDER BY distance LIMIT 0 , 20",
    mysql_real_escape_string($center_lat),
    mysql_real_escape_string($center_lng),
    mysql_real_escape_string($center_lat),
    mysql_real_escape_string($radius));
  $result = mysql_query($query);
  
  if (!$result) {
    die("Invalid query: " . mysql_error());
  }
   else
   { 
    echo "Done";
   }
   // header('Content-type: application/json');
  //$output = array();
  $i=0;
  
   while($row = mysql_fetch_assoc($result)) {
       if($range &gt; 0 )
        {
          $theta = $center_lng - $row['lng'];
          $distance = (sin(deg2rad($center_lat)) * sin(deg2rad($row['lat']))) + (cos(deg2rad($center_lat)) * cos(deg2rad($row['lat'])) * cos(deg2rad($theta)));   
          $distance = acos($distance);
          $distance = rad2deg($distance);
          $distance = $distance * 60 * 1.1515;
          $distance = $distance *1.609344;
          if($range &gt; round($distance,2))
          {
              $info[$i] = "\"".$row['lat']."&amp;".$row['lng']."@".$row['name'];
              $i=$i+1;            
          }
          $myTwitterResult1 = array($info);
      }
      else
      {   
          $info[$i] = "\"".$row['lat']."&amp;".$row['lng']."@".$row['name'];
          $i=$i+1;
          $myTwitterResult1 = array($info);
      }
  }
      $myJSONTweets = json_encode($myTwitterResult1);
      echo $myJSONTweets;
  </code></pre>