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)00↓95.7%PHP

Since Feb 27Pushed 1mo agoCompare

[ Source](https://github.com/cakephp-bakeoff/geospatial)[ Packagist](https://packagist.org/packages/bakeoff/geospatial)[ Docs](https://github.com/mehov/cakephp-geospatial)[ RSS](/packages/bakeoff-geospatial/feed)WikiDiscussions master Synced 1w 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 61% of packages

Maintenance68

Regular maintenance activity

Popularity0

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 50% 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

535d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

cakephpcakephp-plugincakephp5geospatialphpcakephpgeospatial

### 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

[cakephp/debug_kit

CakePHP Debug Kit

86214.9M183](/packages/cakephp-debug-kit)[cakephp/bake

Bake plugin for CakePHP

11212.2M223](/packages/cakephp-bake)[dereuromark/cakephp-ide-helper

CakePHP IdeHelper Plugin to improve auto-completion

1892.4M48](/packages/dereuromark-cakephp-ide-helper)[dereuromark/cakephp-tools

A CakePHP plugin containing lots of useful and reusable tools

3321.0M51](/packages/dereuromark-cakephp-tools)[dereuromark/cakephp-queue

The Queue plugin for CakePHP provides deferred task execution.

308995.7k27](/packages/dereuromark-cakephp-queue)[dereuromark/cakephp-tinyauth

A CakePHP plugin to handle user authentication and authorization the easy way.

131242.7k13](/packages/dereuromark-cakephp-tinyauth)

PHPackages © 2026

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