First Commit, tested out functions.
Signed-off-by: Rick Hays <rhays@haysgang.com>
This commit is contained in:
27
geocode-example.php
Normal file
27
geocode-example.php
Normal 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 =======================================================================================================
|
||||
Reference in New Issue
Block a user