1. Go to this page and download the library: Download powlam/coordinates 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/ */
powlam / coordinates example snippets
use Powlam\Coordinates\Enums\Heading;
use Powlam\Coordinates\Enums\Units;
use Powlam\Coordinates\LatLngAltitude;
$latLngAlt = (new LatLngAltitude(1.23, 4.56, 0.0))
->move(Heading::NORTH, 10.0)
->move(Heading::SOUTH, 1.0)
->move(Heading::EAST, 20.0)
->move(Heading::WEST, 5.0)
->move(Heading::UP, 100.0, Units::METERS)
->move(Heading::DOWN, 30.0, Units::METERS);
// at this point $latLngAlt is at (10.23, 19.56, 70.0)
use Powlam\Coordinates\LatLng;
use Powlam\Coordinates\LatLngBounds;
$bounds = new LatLngBounds(new LatLng(1, 1), new LatLng(10, 10));
// $bounds refers to (1, 1|10, 10)
$bounds->intersects(new LatLngBounds(new LatLng(5, 5), new LatLng(15, 15))); // returns true
$bounds->intersects(new LatLngBounds(new LatLng(15, 15), new LatLng(20, 20))); // returns false
$union = $bounds->union(new LatLngBounds(new LatLng(5, 6), new LatLng(15, 16)));
// $union refers to (1, 1|15, 16)
use Powlam\Coordinates\LatLng;
use Powlam\Coordinates\LatLngBounds;
$bounds = new LatLngBounds(new LatLng(1, 1), new LatLng(10, 10));
// $bounds refers to (1, 1|10, 10)
$bounds->contains(new LatLng(5, 5)); // returns true
$bounds->contains(new LatLng(-5, 5)); // returns false
$bounds->extend(new LatLng(15, 16));
// at this point $bounds has been extended to (1, 1|15, 16)