Download the PHP package ballen/cartographer without Composer
On this page you can find all versions of the php package ballen/cartographer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ballen/cartographer
More information about ballen/cartographer
Files in ballen/cartographer
Package cartographer
Short Description Cartographer is a PHP library for constructing GeoJSON objects.
License GPL-3.0-or-later
Informations about the package cartographer
Cartographer
Cartographer is a PHP library providing the ability to programmatically generate GeoJSON objects.
GeoJSON is a format for encoding a variety of geographic data structures. A GeoJSON object may represent a geometry, a feature, or a collection of features. GeoJSON supports the following geometry types: Point
, LineString
, Polygon
, MultiPoint
, MultiLineString
, MultiPolygon
, and GeometryCollection
. Features in GeoJSON contain a geometry object and additional properties, and a feature collection represents a list of features.
Cartographer was written to adhere to the GeoJSON specification, information can be found here: http://geojson.org/geojson-spec.html
Requirements
- PHP >= 7.3.0
This library is unit tested against PHP 7.3, 7.4, 8.0, 8.1 and 8.2!
If you need to use an older version of PHP, you should instead install the 1.x version of this library (see below for details).
License
This client library is released under the GPLv3 license, you are welcome to use it, improve it and contribute your changes back!
Installation
The recommended way of installing this library is via. Composer; To install using Composer type the following command at the console:
If you need to use an older version of PHP, version 1.x.x supports PHP 5.3, 5.4, 5.5, 5.6, 7.0, 7.1 and 7.2, you can install this version using Composer with this command instead:
Example usage
Point
The "Point" type is the most basic to construct, this example shows an example of plotting a single point on a map.
Check out the GitHub Gist rendition of the GeoJSON output: https://gist.github.com/allebb/55f059efbd708be130112b6d39b16406
Linestring
The "LineString" type contains a list of geographic points (Lat/Longs) of which are joined together to display a line.
Check out the GitHub Gist rendition of the GeoJSON output: https://gist.github.com/allebb/ec422a00b877e28a3d6913df68c5954c
Polygon
A Polygon type object, contains a list of coordinates, the first and last coordinate must match. For Polygons with multiple rings, the first must be the exterior ring and any others must be interior rings or holes.
Check out the GitHub Gist rendition of the GeoJSON object: https://gist.github.com/allebb/30dd0db2a33b763309e64af8cfe3e33c
Feature
A feature enables you to plot a single GeoJSON object on a map with associated properties, Google Maps enable you to render Feature
and FeatureCollection
types.
A example of a Point
feature type is as follows:
Check out the GitHub Gist rendition of the GeoJSON output: https://gist.github.com/allebb/a1dfa013273cc75ce061a13250ae6683
Feature Collection
A feature collection can contain any number of GeoJSON objects with their own properties, all of the features in a collection with their own properties.
Check out the GitHub Gist rendition of the GeoJSON output: https://gist.github.com/allebb/1802d538814ed0875ab05060a439b774
Other examples
Other examples of the types of GeoJSON object type, see the examples/test.php file.
Tests and coverage
This library is fully unit tested using PHPUnit.
I use GitHub Actions for continuous integration, which triggers tests for PHP 7.3, 7.4, 8.0, 8.1 and 8.2 each time a commit is pushed.
If you wish to run the tests yourself you should run the following:
Code coverage can also be run, and a report generated (this does require XDebug to be installed)...
Support
I am happy to provide support via. my personal email address, so if you need a hand drop me an email at: [email protected].
All versions of cartographer with dependencies
ext-json Version *
ballen/collection Version ^2.0
ballen/distical Version ~2.0