1. Go to this page and download the library: Download donotcarry/geokit 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/ */
donotcarry / geokit example snippets
use Geokit\Distance;
$distance = new Distance(1000); // Defaults to meters
// or
$distance = new Distance(1, Distance::UNIT_KILOMETERS);
$meters = $distance->meters();
$kilometers = $distance->kilometers();
$miles = $distance->miles();
$yards = $distance->yards();
$feet = $distance->feet();
$inches = $distance->inches();
$nauticalMiles = $distance->nautical();
use Geokit\BoundingBox;
use Geokit\Polygon;
use Geokit\Position;
$polygon = Polygon::fromPositions(
Position::fromXY(0, 0),
Position::fromXY(1, 0),
Position::fromXY(1, 1)
);
$closedPolygon = $polygon->close();
/** @var Position $position */
foreach ($polygon as $position) {
}
$polygon->contains(Position::fromXY(0.5, 0.5)); // true
/** @var BoundingBox $boundingBox */
$boundingBox = $polygon->toBoundingBox();
use function Geokit\distanceHaversine;
use function Geokit\distanceVincenty;
$distance1 = distanceHaversine($from, $to);
$distance2 = distanceVincenty($from, $to);
use Geokit\Distance;
use Geokit\Position;
use function Geokit\circle;
$circlePolygon = circle(
Position::fromXY(8.50207515, 49.50042565),
Distance::fromString('5km'),
32
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.