PHPackages                             bakeoff/geospatial - 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. [Database &amp; ORM](/categories/database)
4. /
5. bakeoff/geospatial

ActiveCakephp-plugin[Database &amp; ORM](/categories/database)

bakeoff/geospatial
==================

CakePHP Behavior to simplify working with geospatial database columns

1.0.0(1y ago)015↓75%PHP

Since Feb 27Pushed 4mo agoCompare

[ Source](https://github.com/mehov/cakephp-geospatial)[ Packagist](https://packagist.org/packages/bakeoff/geospatial)[ Docs](https://github.com/mehov/cakephp-geospatial)[ RSS](/packages/bakeoff-geospatial/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

CakePHP 5: Geospatial Behavior for Tables
-----------------------------------------

[](#cakephp-5-geospatial-behavior-for-tables)

CakePHP 5.1.0 [introduced](https://book.cakephp.org/5.next/en/appendices/5-1-migration-guide.html#database) limited support for geospatial types.

> The `geometry`, `point`, `linestring`, and `polygon` types are also known as the “geospatial types”. CakePHP offers limited support for geospatial columns. Currently they can be defined in migrations, read in schema reflection, and have values set as text.

Because internally all of the above [are typemapped to `\Cake\Database\Type\StringType`](https://github.com/cakephp/cakephp/blob/a40a07e0705dad895ceb8d8df0e53a94476a1fc4/src/Database/TypeFactory.php#L56), CakePHP:

- *reads* them as string, resulting in binary gibberish;
- *writes* them as literal string (`'POINT(0 0)'`), resulting in database errors ("*SQLSTATE\[22003\]: Numeric value out of range: 1416 Cannot get geometry object from data you send to the GEOMETRY field*").

This plugin offers a quick Behavior you can attach to your tables having geospatial columns. In the spirit of *convention over configuration*, these geospatial columns will be detected automatically, so you don't have to explicitly configure anything. It will then become much simpler and faster to read from, and write to them.

**Note**: right now this plugin supports the `POINT` type only.

Setting up
----------

[](#setting-up)

Install:

```
composer require bakeoff/geospatial

```

In your Table classes:

```
$this->addBehavior('Bakeoff/Geospatial.Geospatial');

```

Reading `POINT`
---------------

[](#reading-point)

Get your entities as usual. The geospatial columns will be parsed.

```
$entity = $myTable->get(123);
debug($entity->position);

```

```
[
    'order' => (int) 1,
    'type' => (int) 1,
    'x' => (float) 12.34,
    'y' => (float) 56.78,
]

```

Writing `POINT`
---------------

[](#writing-point)

```
$data = $this->getRequest()->getData();
// Provide the POINT information as array with two elements
$data['position'] = array($position_x, $position_y);
$entity = $myTable->patchEntity($entity, $data);
$result = $myTable->save($entity);

```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance62

Regular maintenance activity

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

445d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0208168e1ededfaccca6305a05ea15d6f715e7266c9ad16347889f751b2f204e?d=identicon)[mehov](/maintainers/mehov)

---

Top Contributors

[![mehov](https://avatars.githubusercontent.com/u/7813306?v=4)](https://github.com/mehov "mehov (3 commits)")

---

Tags

cakephpgeospatial

### Embed Badge

![Health badge](/badges/bakeoff-geospatial/health.svg)

```
[![Health](https://phpackages.com/badges/bakeoff-geospatial/health.svg)](https://phpackages.com/packages/bakeoff-geospatial)
```

###  Alternatives

[dereuromark/cakephp-databaselog

A CakePHP plugin for storing and viewing application logs in the database

44165.0k2](/packages/dereuromark-cakephp-databaselog)[pgbi/cakephp3-soft-delete

SoftDelete plugin for CakePHP

87291.9k](/packages/pgbi-cakephp3-soft-delete)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
