PHPackages                             karomap/laravel-geo - 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. karomap/laravel-geo

ActiveLibrary

karomap/laravel-geo
===================

Spatial OGC objects integration for Laravel 5.\*

2.0.1(6y ago)01901GPL-3.0-onlyPHPPHP &gt;=5.6.4

Since Mar 17Pushed 5y ago1 watchersCompare

[ Source](https://github.com/karomap/laravel-geo)[ Packagist](https://packagist.org/packages/karomap/laravel-geo)[ RSS](/packages/karomap-laravel-geo/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (5)Versions (14)Used By (0)

[![Latest Version on Packagist](https://camo.githubusercontent.com/4a9fbd9772ec7cf06aba317080446a5e1bc56b1313a8bf207a087b846c4fc15a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b61726f6d61702f6c61726176656c2d67656f3f7374796c653d666c61742d737175617265)](https://packagist.org/packages/karomap/laravel-geo)[![StyleCI](https://camo.githubusercontent.com/7de65c5bcf588be237c5108fd76d95f11bb399307b0c533beff3cf2aa69d903e/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3131323939343234322f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/112994242)[![Total Downloads](https://camo.githubusercontent.com/17c72df44cfd8fb9da42bd242dc69c8a569fd2efec2e5a4c341dd19ff613b466/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b61726f6d61702f6c61726176656c2d67656f3f7374796c653d666c61742d737175617265)](https://packagist.org/packages/karomap/laravel-geo)[![CircleCI](https://camo.githubusercontent.com/72c1fd2dad75749f913f7e51c48eab213af3d8c8624e7f340848b5497b6b1535/68747470733a2f2f696d672e736869656c64732e696f2f636972636c6563692f6275696c642f67682f6b61726f6d61702f6c61726176656c2d67656f2f6d61737465723f7374796c653d666c61742d737175617265)](https://circleci.com/gh/karomap/laravel-geo/tree/master)

Geo Laravel
===========

[](#geo-laravel)

This is a fork from [elevenlab/laravel-geo](https://github.com/eleven-lab/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
========

[](#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](https://github.com/njbarrett/laravel-postgis) for its original work.

Installation &amp; Configuration
================================

[](#installation--configuration)

1. Install using composer

```
$ composer require karomap/laravel-geo
```

2. Replace under the Service Providers section ('providers' array) in `config/app.php` this line

```
Illuminate\Database\DatabaseServiceProvider::class,
```

with this one:

```
Karomap\GeoLaravel\DatabaseServiceProvider::class
```

3. If you need it, under the Alias section ('aliases' array) in config/app.php add this line:

```
'GeoModel'      => Karomap\GeoLaravel\Eloquent\Model::class,
```

Quick Documentation
===================

[](#quick-documentation)

Create table with spatial references
------------------------------------

[](#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):

```
