i cant google api give same answer driving distance when using google maps. use data test accuracy of api vs google maps. using cakephp php code acceptable.
test data lat/long (not people know) (point1) address lat: -38.041968 address long: 145.26416599999993 (point 2) address lat: -37.988981 address long: 145.53447499999993 the distance between these 2 points on google maps says 41.3km on google api below same lat/long points 33.7km inaccurate rely on. going on google api doesnt seem work?
$stlat = $student['student']['address_lat']; $stlong = $student['student']['address_long']; foreach ($tutors $key => $item): $tutlat = $item['tutor']['address_lat']; //this lat/long above $tutlong = $item['tutor']['address_long']; $testurl = "https://maps.googleapis.com/maps/api/distancematrix/json?origins=".$stlat.",".$stlong."&destinations=".$tutlat.",".$tutlong."&mode=driving&language=en&sensor=false"; $data1 = file_get_contents($testurl); $data = utf8_decode($data1); $obj = json_decode($data1); $dist2=$obj->rows[0]->elements[0]->distance->text; debug($obj->rows[0]->elements[0]->distance->text); //km endforeach;
the answer on google maps not getting optimum distance, on api am. problem solved
Comments
Post a Comment