PHP Classes


Recommend this page to a friend!
  Classes of Jericko Tejido   Geodesy PHP   Download  
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: Geodesy PHP
Get distance between places with their coordinates
Author: By
Last change: Added Reference Datums and Ellipsoid Models.
Date: 5 years ago
Size: 2,517 bytes


Class file image Download



Geodesy-PHP is a port of some known geodesic/math functions for getting distance from a known point A to a known point B given their coordinates (good for working out distances between different latitude/longitude data provided by Google Geolocation or any RESTful APIs).

It also supports conversion between units of length, Polar position to Cartesian coordinates, and different Reference Datums.

It provides distance calculations by:

Great-circle distance

  1. Spherical Law of Cosines
  2. Haversine Formula

Ellipsoid Geodesics

  1. Vincenty's Formula
  2. Hubeny's Formula
  3. Thomas' Formula
  4. Andoyer-Lambert Formula
  5. Elliptic Distance
  6. Forsythe-Andoyer-Lambert Formula

Unit Conversion

All operations are set in Metre. But it can also convert distance (and other transformation) values to:

  1. Kilometre
  2. Mile
  3. Nautical Mile
  4. Astronomical Unit

Position Conversion

It also allows coordinate/geographical conversions between the ff:

  1. Polar to Cartesian
  2. Cartesian to Polar
  3. Polar to Web Mercator
  4. Web Mercator to Polar

Transformation Options

Reference Datums are, by default, set to WGS84. You can also transform one coordinate taken from a different source to another (see this for reference), as it also comes with some pre-built datums (though very limited in number as it has little use for me aside from WGS84, i.e. at the time of writing this).

The following are the transformer options:

  1. 3-Parameter Molodensky Transformer
  2. 7-Parameter Helmert Transformer
  3. 10-Parameter Molodensky-Badekas Transformer


You can read about it here