You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
1.5 KiB

<?php
// == GEOCODE CLASS ====================================================================================================
require_once 'class/geocode.php';
// -- Init Class
$geocode = new geocode();
// -- Straight Line Distance -------------------------------------------------------------------------------------------
echo $geocode->straight_line_distance(39.10968, -94.57949, 39.17521, -94.53957) ;
echo '<br/>' . str_repeat('=',60) . '<br/>';
// -- Get the Lat/Lon of a address -------------------------------------------------------------------------------------
$latlong = $geocode->getLatLong('1600 Pennsylvania Ave NW, Washington, DC 20500');
echo 'STATUS: ' . $latlong['status'] . '<br />';
echo 'LAT: ' . $latlong['lat'] . '<br />';
echo 'LON: ' . $latlong['lon'] . '<br />';
echo '<br/>' . str_repeat('=',60) . '<br/>';
// -- Drive Distance ---------------------------------------------------------------------------------------------------
$origin = '1600 Pennsylvania Ave NW, Washington, DC 20500';
$destination = '4433 N Indiana Ave, Kansas City, MO 64117';
$dist = $geocode->Get_Distance($origin, $destination, 'driving', 'imperial');
echo 'STATUS: ' . $dist['status'] . '<br/>';
echo 'DISTANCE: ' . $dist['distance'] . '<br/>';
echo 'DURATION: ' . $dist['duration'] . '<br/>';
echo '<br/>' . str_repeat('=',60) . '<br/>';
// == END SCRIPT =======================================================================================================