PHPackages                             laravie/geotools - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. laravie/geotools

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

laravie/geotools
================

Geo-related tools PHP 7+ library

v1.2.0(5y ago)18136.3k↑16.3%5[1 issues](https://github.com/laravie/geotools/issues)1MITPHPPHP ^7.3 || ^8.0CI failing

Since Feb 10Pushed 5y ago1 watchersCompare

[ Source](https://github.com/laravie/geotools)[ Packagist](https://packagist.org/packages/laravie/geotools)[ Fund](https://paypal.me/crynobone)[ Fund](https://liberapay.com/crynobone)[ RSS](/packages/laravie-geotools/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (6)Dependencies (2)Versions (9)Used By (1)

Geotools
========

[](#geotools)

**Geotools** is a PHP geo-related library.

[![tests](https://github.com/laravie/geotools/workflows/tests/badge.svg?branch=master)](https://github.com/laravie/geotools/actions?query=workflow%3Atests+branch%3Amaster)[![Latest Stable Version](https://camo.githubusercontent.com/29c8f01952124756e247e8b8e6c1bf1510cd6812cbcfa63c12533384de76dea6/68747470733a2f2f706f7365722e707567782e6f72672f6c6172617669652f67656f746f6f6c732f762f737461626c65)](https://packagist.org/packages/laravie/geotools)[![Total Downloads](https://camo.githubusercontent.com/3b66b91cd9cd931b6f34ae815be529800bc38cf6655b063155512ebda8dfa21f/68747470733a2f2f706f7365722e707567782e6f72672f6c6172617669652f67656f746f6f6c732f646f776e6c6f616473)](https://packagist.org/packages/laravie/geotools)[![Latest Unstable Version](https://camo.githubusercontent.com/9eec125a41fabd03fecfa0a52cba8e8e7c641d149edcd26cb1bb909349f5e47f/68747470733a2f2f706f7365722e707567782e6f72672f6c6172617669652f67656f746f6f6c732f762f756e737461626c65)](https://packagist.org/packages/laravie/geotools)[![License](https://camo.githubusercontent.com/9a4dff976e1dd5e0595721050cf3df1a9518d157213b691aaa658be5178f2d40/68747470733a2f2f706f7365722e707567782e6f72672f6c6172617669652f67656f746f6f6c732f6c6963656e7365)](https://packagist.org/packages/laravie/geotools)

Features
--------

[](#features)

- Accept **almost** all kind of WGS84 [geographic coordinates](http://en.wikipedia.org/wiki/Geographic_coordinate_conversion) as coordinates. [»](#coordinate--ellipsoid)
- Support **23 different ellipsoids** and it's easy to provide a new one if needed. [»](#coordinate--ellipsoid)
- **Convert** and **format** decimal degrees coordinates to decimal minutes or degrees minutes seconds coordinates. [»](#convert)
- **Convert** decimal degrees coordinates in the [Universal Transverse Mercator](http://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system)(UTM) projection. [»](#convert)
- Compute the distance in **meter** (by default), **km**, **mi** or **ft** between two coordinates using **flat**, **great circle**, **haversine** or **vincenty** algorithms. [»](#distance)
- Compute the initial and final **bearing** from the origin coordinate to the destination coordinate in degrees. [»](#point)
- Compute the initial and final **cardinal point** (direction) from the origin coordinate to the destination coordinate, read more in [wikipedia](http://en.wikipedia.org/wiki/Cardinal_direction). [»](#point)
- Compute the **half-way point** (coordinate) between the origin and the destination coordinates. [»](#point)
- Compute the **destination point** (coordinate) with given bearing in degrees and a distance in meters. [»](#point)
- Encode a coordinate to a **geo hash** string and decode it to a coordinate, read more in [wikipedia](http://en.wikipedia.org/wiki/Geohash) and on [geohash.org](http://geohash.org/). [»](#geohash)
- Encode a coordinate via the 10:10 algorithm. [»](#1010)
- **Polygon** class provides methods to check either a poing (coordinate) is in, or on the polygon's boundaries. [»](#polygon)
- ... more to come ...

Installation
------------

[](#installation)

**Geotools** can be found on [Packagist](https://packagist.org/packages/laravie/geotools). The recommended way to install **Geotools** is through [composer](http://getcomposer.org).

Run the following on the command line:

```
php composer require laravie/geotools=~1.0

```

Usage &amp; API
---------------

[](#usage--api)

Coordinate &amp; Ellipsoid
--------------------------

[](#coordinate--ellipsoid)

The default geodetic datum is [WGS84](http://en.wikipedia.org/wiki/World_Geodetic_System) and coordinates are in decimal degrees.

Here are the available ellipsoids: `AIRY`, `AUSTRALIAN_NATIONAL`, `BESSEL_1841`, `BESSEL_1841_NAMBIA`, `CLARKE_1866`, `CLARKE_1880`, `EVEREST`, `FISCHER_1960_MERCURY`, `FISCHER_1968`, `GRS_1967`, `GRS_1980`, `HELMERT_1906`, `HOUGH`, `INTERNATIONAL`, `KRASSOVSKY`, `MODIFIED_AIRY`, `MODIFIED_EVEREST`, `MODIFIED_FISCHER_1960`, `SOUTH_AMERICAN_1969`, `WGS60`, `WGS66`, `WGS72`, and `WGS84`.

If you need to use an other ellipsoid, just create an array like this:

```
