dev-master
9999999-dev https://github.com/patrickkempff/LocationA simple library for dealing with (geographical) locations.
MIT
The Requires
- php >=5.4.0
- beberlei/assert ~2.5
The Development Requires
geo location coodinates
A simple library for dealing with (geographical) locations.
A simple library for dealing with (geographical) locations., (*2)
use Location\Location; use Location\Coordinate\Coordinate2d; use Location\Distance\Haversine; // Amsterdam, NL. $amsterdam = new Location(new Coordinate2d(52.3079989, 4.9715451)); // Venlo, NL. $venlo = new Location(new Coordinate2d(51.3703748, 6.1724031)); // The distance between Venlo and Amsterdam is 132950 meters (132km 950m) // using the Haversine formula. $distance = $amsterdam->calculateDistanceFromLocation($venlo, new Haversine());
Please note that UTM, MGRS and USNG coordinate systems are not yet supported., (*3)
$ composer require patrickkempff/location
{ "require": { "patrickkempff/location": "dev-master" } }
<?php require 'vendor/autoload.php'; use Location\Location; use Location\Coordinate\Coordinate2d; use Location\Distance\Haversine; // Amsterdam, NL. $amsterdam = new Location(new Coordinate2d(52.3079989, 4.9715451)); // Venlo, NL. $venlo = new Location(new Coordinate2d(51.3703748, 6.1724031)); // The distance between Venlo and Amsterdam is 132950 meters (132km 950m) // using the Haversine formula. $distance = $amsterdam->calculateDistanceFromLocation($venlo, new Haversine());
Please note that the recommend way to install Location is via composer. If you really want to install Location manually, you can download Location from the repo and unpack the files into your project., (*4)
<?php require 'path/to/Location.php'; require 'path/to/Coordinate/Coordinate2d.php'; require 'path/to/Distance/Haversine.php'; use Location\Location; use Location\Coordinate\Coordinate2d; use Location\Distance\Haversine; // Amsterdam, NL. $amsterdam = new Location(new Coordinate2d(52.3079989, 4.9715451)); // Venlo, NL. $venlo = new Location(new Coordinate2d(51.3703748, 6.1724031)); // The distance between Venlo and Amsterdam is 132950 meters (132km 950m) // using the Haversine formula. $distance = $amsterdam->calculateDistanceFromLocation($venlo, new Haversine());
A simple library for dealing with (geographical) locations.
MIT
geo location coodinates