PHPackages                             chriscollins/gis-utils - 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. chriscollins/gis-utils

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

chriscollins/gis-utils
======================

A PHP library for performing GIS tasks, such as geocoding addresses and transforming coordinates.

3.0.0(1w ago)410MITPHPPHP &gt;=8.4

Since Oct 27Pushed 1w ago1 watchersCompare

[ Source](https://github.com/chriscollins/gis-utils)[ Packagist](https://packagist.org/packages/chriscollins/gis-utils)[ RSS](/packages/chriscollins-gis-utils/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (5)Dependencies (10)Versions (7)Used By (0)

GIS Utils
=========

[](#gis-utils)

[![Build Status](https://github.com/chriscollins/gis-utils/actions/workflows/build.yml/badge.svg)](https://github.com/chriscollins/gis-utils/actions/workflows/build.yml/badge.svg)

A PHP library for performing GIS tasks, such as geocoding addresses and transforming coordinates.

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

[](#installation)

Require in your project via composer as follows:

```
{
    "require": {
        "chriscollins/gis-utils": "~3.0.0"
    }
}
```

Run `composer install`.

Usage
-----

[](#usage)

The majority of functionality is accessed via the `\ChrisCollins\GisUtils\Coordinate\LatLong` class.

### Creating a LatLong object manually

[](#creating-a-latlong-object-manually)

You will first need to create a `\ChrisCollins\GisUtils\Datum\Datum` object for the [datum](http://en.wikipedia.org/wiki/Datum_(geodesy)) you wish to represent. Datums are composed of a name, an `\ChrisCollins\GisUtils\Ellipsoid\Ellipsoid` representing the Earth and a `\ChrisCollins\GisUtils\Equation\HelmertTransform` to convert a coordinate in the commonly used [WGS84 datum](http://en.wikipedia.org/wiki/World_Geodetic_System) to a coordinate in your datum:

```
$airy1830Ellipsoid = new \ChrisCollins\GisUtils\Ellipsoid\Ellipsoid(
    'AIRY_1830', // Name.
    6377563.396, // Semi-major axis.
    6356256.910, // Semi-minor axis.
    299.3249646 // Flattening.
);

$osgb36ToWgs84HelmertTransform = new \ChrisCollins\GisUtils\Equation\HelmertTransform(
    -446.448, // Translation X.
    125.157, // Translation Y.
    -542.060, // Translation Z.
    -0.1502, // Rotation X.
    -0.2470, // Rotation Y.
    -0.8421, // Rotation Z.
    20.4894 // Scale factor.
);

$osgb36Datum = new \ChrisCollins\GisUtils\Datum\Datum('OSGB36', $airy1830Ellipsoid, $osgb36ToWgs84HelmertTransform);
```

The `\ChrisCollins\GisUtils\Ellipsoid\EllipsoidFactory`, `\ChrisCollins\GisUtils\Datum\DatumFactory` and `\ChrisCollins\GisUtils\Equation\HelmertTransformFactory` classes are available to create a few commonly used options:

```
$ellipsoidFactory = new \ChrisCollins\GisUtils\Ellipsoid\EllipsoidFactory();
$helmertTransformFactory = new \ChrisCollins\GisUtils\Equation\HelmertTransformFactory();

$datumFactory = new \ChrisCollins\GisUtils\Datum\DatumFactory(
    $ellipsoidFactory,
    $helmertTransformFactory
);

$wgs84Datum = $datumFactory->create(\ChrisCollins\GisUtils\Datum\DatumFactory::DATUM_WGS84);
```

There is also the `\ChrisCollins\GisUtils\Facade` class which handles the dependency injection for you via [Pimple](http://pimple.sensiolabs.org), but is a little less flexible:

```
$facade = new \ChrisCollins\GisUtils\Facade();

$wgs84Datum = $facade->createDatum(\ChrisCollins\GisUtils\Datum\DatumFactory::DATUM_WGS84);
```

Once you have your `Datum`, you can create `LatLong` objects if you know your chosen point's latitude, longitude, and height in your chosen datum:

```
$latLong = new \ChrisCollins\GisUtils\Coordinate\LatLong(
    51.88328, // Latitude.
    -3.43684, // Longitude.
    886, // Height in metres.
    $wgs84Datum // Datum.
);
```

### Creating a LatLong object from a lookup

[](#creating-a-latlong-object-from-a-lookup)

This library also provides a method of creating `LatLong` objects with the `\ChrisCollins\GisUtils\Lookup\GoogleLookup` class, which looks up the coordinates of an address by using [Google's geocoding service](https://developers.google.com/maps/documentation/geocoding). Please take note of Google's terms of use and API limits for using the geocoder service. Coordinates created by this service will use the WGS84 datum. To use the class, you will need to instantiate an `\\ChrisCollins\GisUtils\Address\Address`:

```
$address = new \ChrisCollins\GisUtils\Address\Address();
$address->setHouseNumber(10)
    ->setAddress1('Downing Street')
    ->setTown('London')
    ->setCountry('England')
    ->setPostcode('SW1A 2AA');
```

You can then perform the lookup as follows:

```
$googleLookup = new \ChrisCollins\GisUtils\Lookup\GoogleLookup(
    $datumFactory,
    new \ChrisCollins\GeneralUtils\Curl\CurlHandle(),
    new \ChrisCollins\GeneralUtils\Json\JsonCodec()
);

$latLong = $googleLookup->addressToLatLong($address);
```

Again, this functionality is available via the `Facade` class, if you want to have the dependency injection handled for you:

```
$facade = new \ChrisCollins\GisUtils\Facade();

$latLong = $facade->googleAddressToLatLong($address);
```

### Functionality available

[](#functionality-available)

Once you have a `LatLong` object, you can perform calculations to calculate distances between it and other `LatLong` objects ([Spherical law of cosines](http://en.wikipedia.org/wiki/Spherical_law_of_cosines) and the more accurate, more computationally expensive [Vincenty formula](http://en.wikipedia.org/wiki/Vincenty's_formulae) are both supported), convert it to equivalent coordinates in other datums, calculate initial and final bearings to other `LatLongs` and calculate the destination `LatLong` that would be reached if a given initial bearing was followed for a certain distance. There is also support for converting the `LatLong` to cartesian coordinates (`\ChrisCollins\GisUtils\Coordinate\CartesianCoordinate`) and back.

Generate the code documentation via phpdox for further information.

###  Health Score

54

—

FairBetter than 97% of packages

Maintenance98

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity85

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~915 days

Recently: every ~1082 days

Total

6

Last Release

7d ago

Major Versions

1.0.1 → 2.0.02022-08-21

2.0.2 → 3.0.02026-05-07

PHP version history (3 changes)1.0.0PHP &gt;=5.3.0

2.0.0PHP &gt;=7.4.0

3.0.0PHP &gt;=8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/37fa79bdf49783e3045d8e823385db2321549a76504af6f223aae3e80dfaa515?d=identicon)[chriscollins](/maintainers/chriscollins)

---

Top Contributors

[![chriscollins](https://avatars.githubusercontent.com/u/783289?v=4)](https://github.com/chriscollins "chriscollins (7 commits)")

---

Tags

mappinggislatitudelongitudepostcodegeocodeDatum

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/chriscollins-gis-utils/health.svg)

```
[![Health](https://phpackages.com/badges/chriscollins-gis-utils/health.svg)](https://phpackages.com/packages/chriscollins-gis-utils)
```

###  Alternatives

[anthonymartin/geo-location

Powerful GeoCoding library: Retrieve bounding box coordinates, distances between geopoints, point in polygon, get longitude and latitude from addresses and more with GeoLocation for PHP

196949.5k5](/packages/anthonymartin-geo-location)[php-coord/php-coord

PHPCoord is a PHP library to aid in handling coordinates. It can convert coordinates for a point from one system to another and also calculate distance between points.

110914.5k12](/packages/php-coord-php-coord)[ballen/distical

A distance (Lat/Long) calculation library for PHP

40180.2k2](/packages/ballen-distical)[data-values/geo

Geographical value objects, parsers and formatters

20631.0k18](/packages/data-values-geo)[laravie/geotools

Geo-related tools PHP 7+ library

19105.4k1](/packages/laravie-geotools)[adlino/locations

Iran Provinces, Counties and Cities with a Google Map Location for Laravel.

171.3k](/packages/adlino-locations)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
