PHP code example of aspross / geodata

1. Go to this page and download the library: Download aspross/geodata library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

aspross / geodata example snippets



use \AnthonySpross\Assets\GeoData; 

getCoordinates(string $address)

getDistance(string $location1Latitude, string $location1Longitude, string $location2Latitude, string $location2Longitude, string $unit = 'K')



// get geodata coordinates for an address
$coordinates = GeoData::getCoordinates("Werner-Heisenberg-Allee 25, 80939 München, Deutschland");

// get distance between two geodata positions
$distance = GeoData::getDistance("48.8588377", "2.2770206", "52.5067614", "13.2846508", "K");

/**
 * unit specification | $unit
 * 
 * K -> Kilometer
 * M -> Miles
 * N -> Nautical miles
**/