Skip to content
This repository has been archived by the owner on Jul 19, 2022. It is now read-only.

treffynnon/Geographic-Calculations-in-PHP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation


#DEPRECATED This library is now deprecated in favour of my new Navigator library. Please use it instead - its much better, tested and makes use of newer PHP features!


#Geographic Calculations in PHP Recently (at the time this was originally written anyway) I have been involved with a project that maps yachts during an ocean race, which got me thinking about basic calculations and conversions that would be useful to fellow developers. I envisage this being useful in projects leveraging Google or Yahoo maps. For the moment the class performs the following functions:

  • Calculate the distance between two coordinate points on the earth's surface (using Vincenty, Haversine, Great Circle or The Cosine Law)
  • Conversion between units (metres to kilometres, nautical miles and miles).
  • Convert coordinate notation (decimals to degrees, minutes & seconds and back again).

That is all you get for the moment, but it is pretty powerful for getting a "as the crow flies" distance between two coordinates. Vincenty's formula is the most accurate method for calculation, but it is also the most processor intensive.

The attached file package contains an extensive set of "api" documentation and PHPDoc comments throughout the class to make customisation and use easier. I have also included a demo php file in there so you can see how it is intended to be used. It should also be pointed out here that this class requires some of the new OO features only available in PHP5, but it could easily be edited to be backwards compatible with PHP4.

About

This library is now deprecated in favour of my new Navigator library (https://github.com/treffynnon/Navigator). Please use it instead - its much better, tested and makes use of newer PHP features!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages