Download the PHP package league/geotools without Composer

On this page you can find all versions of the php package league/geotools. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

Please rate this library. Is it a good library?

All versions of geotools with dependencies

Informations about the package geotools

Geotools

Geotools is a PHP geo-related library, built atop Geocoder and React libraries.

Build Status Latest Version Total Downloads Quality Score SensioLabs Insight PHP7 Ready

Features

Installation

Geotools can be found on Packagist. The recommended way to install Geotools is through composer.

Run the following on the command line:

Protip: you should browse the league/geotools page to choose a stable version to use, avoid the @stable meta constraint.

Important: you should use the 0.4 version if you use Geocoder 2.x or/and PHP 5.3.

And install dependencies:

Now you can add the autoloader, and you will have access to the library:

Usage & API

Coordinate & Ellipsoid

The default geodetic datum is WGS84 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:

Geotools is built atop Geocoder. It means it's possible to use the \Geocoder\Model\Address directly but it's also possible to use a string or a simple array with its latitude and longitude.

It supports valid and acceptable geographic coordinates like:

Latitudes below -90.0 or above 90.0 degrees are capped through \League\Geotools\Coordinate\Coordinate::normalizeLatitude().
Longitudes below -180.0 or above 180.0 degrees are wrapped through \League\Geotools\Coordinate\Coordinate::normalizeLongitude().

Convert

It provides methods (and aliases) to convert decimal degrees WGS84 coordinates to degrees minutes seconds or decimal minutes WGS84 coordinates. You can format the output string easily.

You can also convert them in the Universal Transverse Mercator (UTM) projection (Southwest coast of Norway and the region of Svalbard are covered).

Here is the mapping:

Decimal minutes Latitude Longitude
Positive or negative sign %P %p
Direction %L %l
Degrees %D %d
Decimal minutes %N %n
Degrees minutes seconds Latitude Longitude
Positive or negative sign %P %p
Direction %L %l
Degrees %D %d
Minutes %M %m
Seconds %S %s

Batch

It provides a very handy way to batch geocode and reverse geocoding requests in serie or in parallel against a set of providers.
Thanks to Geocoder and React libraries.

It's possible to batch one request (a string) or a set of request (an array) against one provider or set of providers.

You can use a provided cache engine or use your own by setting a cache object which should implement League\Geotools\Cache\CacheInterface and extend League\Geotools\Cache\AbstractCache if needed.

At the moment Geotools supports any PSR-6 cache.

NB: Before you implement caching in your app please be sure that doing so does not violate the Terms of Service for your(s) geocoding provider(s).

You should get 24 results (4 values to geocode against 6 providers) something like:

Batch reverse geocoding is something like:

If you want to batch it in serie, replace the method parallel() by serie().

To optimize batch requests you need to register providers according to their capabilities and what you're looking for (geocode street addresses, geocode IPv4, geocode IPv6 or reverse geocoding), please read more at the Geocoder library doc.

Distance

It provides methods to compute the distance in meter (by default), km, mi or ft between two coordinates using flat (most performant), great circle, haversine or vincenty (most accurate) algorithms.

Those coordinates should be in the same ellipsoid.

Point

It provides methods to compute the initial and final bearing in degrees, the initial and final cardinal direction, the middle point and the destination point. The middle and the destination points returns a \League\Geotools\Coordinate\Coordinate object with the same ellipsoid.

Geohash

It provides methods to get the geo hash and its bounding box's coordinates (SouthWest & NorthEast) of a coordinate and the coordinate and its bounding box's coordinates (SouthWest & NorthEast) of a geo hash.

10:10

Represent a location with 10m accuracy using a 10 character code that includes features to prevent errors in entering the code. Read more about the algorithm here.

Vertex

Represents a segment with a direction. You can find if two vertexes are on the same line.

Polygon

It helps you to know if a point (coordinate) is in a Polygon or on the Polygon's boundaries and if this in on a Polygon's vertex.

First you need to create the polygon, you can provide:

CLI

It provides command lines to compute methods provided by Distance, Point, Geohash and Convert classes. Thanks to the Symfony Console Component.

Compute street addresses, IPv4s or IPv6s geocoding and reverse geocoding right in your console.

It's possible to define and precise your request through these options:

The last command will show an output like this:

Integration with Frameworks

Unit Tests

To run unit tests, you'll need the cURL extension and a set of dependencies, you can install them using Composer:

Once installed, just launch the following command:

Credits

Acknowledgments

Changelog

See the changelog file

Contributing

Please see CONTRIBUTING for details.

Support

Bugs and feature request are tracked on GitHub

Contributor Code of Conduct

As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.

We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.

Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.

This Code of Conduct is adapted from the Contributor Covenant, version 1.0.0, available at http://contributor-covenant.org/version/1/0/0/

License

Geotools is released under the MIT License. See the bundled LICENSE file for details.

Bitdeli Badge


Version
Requires php Version ^7.0
psr/cache Version ^1.0
willdurand/geocoder Version ^4.2
react/promise Version ^2.2
symfony/console Version ^2.7 || ^3.0 || ^4.0 || ^5.0
symfony/property-access Version ^2.7 || ^3.0 || ^4.0 || ^5.0
symfony/serializer Version ^2.7 || ^3.0 || ^4.0 || ^5.0
react/event-loop Version 0.4.*
php-http/discovery Version ^1.0
cache/array-adapter Version ^1.0
ext-bcmath Version *

The package league/geotools contains the following files

Loading the files please wait ....