2017 © Pedro Peláez
 

library geo

Calculate distance between two coordinates

image

ayeo/geo

Calculate distance between two coordinates

  • Saturday, April 25, 2015
  • by ayeo
  • Repository
  • 5 Watchers
  • 3 Stars
  • 11,634 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 9 % Grown

The README.md

Build Status, (*1)

Geo Distance

Simply way to calculate distance between two geo coordinates. There is Vincenty's formula used to do the calculations., (*2)

Install by Composer

require: "ayeo/geo": "1.0.*"

Example use

use Ayeo\Geo\Coordinate;
use Ayeo\Geo\DistanceCalculator;

//London: 51°30′N 0°07′W
$london = new Coordinate\Degree();
$london->setLatitude(51, 30, 00, 'N');
$london->setLongitude(00, 07, 00, 'W');

//Buenos Aires: 34°35′S 58°55′W
$buenosAires = new Coordinate\Degree();
$buenosAires->setLatitude(34, 35, 00, 'S');
$buenosAires->setLongitude(58, 55, 00, 'W');

$calculator = new DistanceCalculator();
$calculator->getDistance($london, $buenosAires); //result in meters

You can also use decimal coordinates, (*3)

$example = new Coordinate\Decimal(53.2311, 18.1222);

DistanceCalculator allows to set radius, precision and multiplier. Default radius is set to Earth., (*4)

$calculator = new DistanceCalculator();

$calculator->setMultiplier(1); //default value, returns distance in meters
$calculator->setMultiplier(1/1000); //kilometers
$calculator->setMultiplier(1/1000000); //thousands of kilometers

$calculator->setRadius(1737100); //Moon radius :)

$calculator->setPrecision(0); //returns integers

The Versions

25/04 2015

1.0.0

1.0.0.0

Calculate distance between two coordinates

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

25/04 2015

0.0.0

0.0.0.0

Calculate distance between two coordinates

  Sources   Download

MIT

The Development Requires

25/04 2015

1.1.0.x-dev

1.1.0.9999999-dev

Calculate distance between two coordinates

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

distance geolocation coordinate earth

25/04 2015

dev-master

9999999-dev

Calculate distance between two coordinates

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

distance geolocation coordinate earth