First Commit, tested out functions.

Signed-off-by: Rick Hays <rhays@haysgang.com>
This commit is contained in:
2019-09-27 13:11:42 -05:00
parent ea5cf2cf6f
commit 48b38f9501
2 changed files with 139 additions and 0 deletions

27
geocode-example.php Normal file
View File

@@ -0,0 +1,27 @@
<?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 =======================================================================================================