Skip to content

aratnikov/distance-to-sea

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Distance to seas

Calculation of the nearest distance to the seas: Azov, Baltic, Caspian and Black.

Requirements

Minimum required PHP version is 7.3.

Installation

Using Composer, just add it to your composer.json by running:

composer require aratnikov/distance-to-sea 

Examples/Usage

<?php

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

License

The MIT License (MIT). Please see License File for more information.