PHP code example of aratnikov / distance-to-sea

1. Go to this page and download the library: Download aratnikov/distance-to-sea 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/ */

    

aratnikov / distance-to-sea example snippets




use ARatnikov\DistanceToSea\{Calculating, Seas};

$calculating = Calculating::getInstance();

$lat = 44.47755606247829;
$lng = 34.145802750750015;

//to the nearest sea
$result = $calculating->calculateToNearestSea($lat, $lng);

//or to a certain sea
$result = $calculating->calculateToSea(Seas::BLACK_SEA, $lat, $lng);

echo "To the {$result->getSeaName()} {$result->getDistance()} meters"; // To the black_sea 700 meters