Download the PHP package aeris/spatial without Composer
On this page you can find all versions of the php package aeris/spatial. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download aeris/spatial
More information about aeris/spatial
Files in aeris/spatial
Informations about the package spatial
Spatial
Representations of spatial data.
Installation
Components
GeometryConverter
The GeometryConverter
component may be used to convert geometry data between different formats. The following conversions are currently supported:
- GeoJson Polygon to WKT
- GeoJson MultiPolygon to WKT
Additional conversions can be made by using Geometry
objects directly, via the ConvertibleGeometryInterface::FromArray()
and ConvertibleGeometryInterface::toWkt()
methods (see Geometry component documentation)
Examples
Geometry
Geometry
components are object representations of spatial data structures. Objects implementing \Aeris\Spatial\Geometry\ConvertibleGeometryInterface
may be easily converted between array and WKT (string) formats using the FromArray(array $data)
and toWkt()
methods
Some Geometry
components may implement additional conversion methods. For example, \Aeris\Spatial\Geometry\MultiPolygon
implements a FromFeatureCollection()
method, which makes it easy to convert a GeoJson feature collection to a MultiPolygon
object.
Examples
The following example demonstrates converting a GeoJson FeatureCollection into a MultiPolygon object.
You could then use the MultiPolygon object to execute a MySql spatial query:
Util
The Aeris\Spatial\Util
namespace contains some utility function for working with spatial components.
Util\bearing
Returns the direction (in degrees) between two coordinates.
Util\compassDirection
Returns the compass rose direction between two coordinates.
Possible return values:
- NNE
- NE
- ENE
- E
- ESE
- SE
- SSE
- S
- SSW
- SW
- WSW
- W
- WNW
- NW
- NNW
- N