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↓93.8%PHP

Since Feb 27Pushed 5mo 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 today

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

28

—

LowBetter than 52% of packages

Maintenance57

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity38

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

490d 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)")

---

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

[cakephp/debug_kit

CakePHP Debug Kit

86314.7M170](/packages/cakephp-debug-kit)[cakephp/bake

Bake plugin for CakePHP

11212.0M201](/packages/cakephp-bake)[dereuromark/cakephp-queue

The Queue plugin for CakePHP provides deferred task execution.

308954.9k25](/packages/dereuromark-cakephp-queue)[dereuromark/cakephp-ide-helper

CakePHP IdeHelper Plugin to improve auto-completion

1882.3M43](/packages/dereuromark-cakephp-ide-helper)[dereuromark/cakephp-databaselog

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

44172.5k2](/packages/dereuromark-cakephp-databaselog)[dereuromark/cakephp-tools

A CakePHP plugin containing lots of useful and reusable tools

3361.0M51](/packages/dereuromark-cakephp-tools)

PHPackages © 2026

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