Download the PHP package karomap/laravel-geo without Composer
On this page you can find all versions of the php package karomap/laravel-geo. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download karomap/laravel-geo
More information about karomap/laravel-geo
Files in karomap/laravel-geo
Package laravel-geo
Short Description Spatial OGC objects integration for Laravel 5.*
License GPL-3.0-only
Informations about the package laravel-geo
Geo Laravel
This is a fork from elevenlab/laravel-geo with some modifications for compatibility with Laravel 5.4+
Note: In this version you can use either geometry or geography column type for PostGIS with SRID.
Features
- GeoSpatial integration on Laravel 5.4+:
- Create geospatial columns using Schema and migrations
- Save and retrieve geospatial attributes using directly OpenGeoConsortium Spatial Objects (this package depends from PHP-OGC)
- Build spatial query directly with the laravel fluent query builder
- Supported types: Point, MultiPoint, Linestring, MultiLinestring, Polygon, MultiPolygon, GeometryCollection
- Supported drivers:
- Postgres: Posgis extension Extensions (geometry types)
- MySql: Extension for Spatial Data (geometry types)
Thanks to laravel-postgis for its original work.
Installation & Configuration
-
Install using composer
- Replace under the Service Providers section ('providers' array) in
config/app.php
this line
with this one:
- If you need it, under the Alias section ('aliases' array) in config/app.php add this line:
Quick Documentation
Create table with spatial references
To add a geospatial field to your migration you can use these methods:
- point, multipoint linestring, multilinestring, polygon, multipolygon, geometrycollection
Example (NB: the schema is over-simplified):
Add spatial attributes to a Model
In order to handle dynamically geospatial attributes during CRUD operations, you need to:
- substitute the Eloquent Model abstract object with a custom Model
- define which attribute belongs to which geospatial type, defining the
$geometries
attribute (you can find here the available types)
Manipulate spatial attributes of a Model
Builds queries
There are two different groups of methods that are available, one to use the underlying database engine to perform spatial operations on existing objects, and another to build fluent queries and perform operations on database-resident data.
Given two OGCObjects, you can perform those operations:
-
intersection
-
difference
-
contains
-
intersects
-
touches
-
overlaps
-
centroid
-
distance
- equals
Given an illuminate Query Builder object, you can use:
-
whereEquals
-
whereNotEquals
-
orWhereEquals
-
orWhereNotEquals
-
whereContains
-
whereNotContains
-
orWhereContains
-
orWhereNotContains
-
whereIntersects
-
whereNotIntersects
-
orWhereIntersects
-
orWhereNotIntersects
-
whereTouches
-
whereNotTouches
-
orWhereTouches
-
orWhereNotTouches
-
whereOverlaps
-
whereNotOverlaps
-
orWhereOverlaps
- orWhereNotOverlaps
ToDo
- improve documentation
- add examples for "Build queries" section
- add manual installation guide
- add missing ST_functions