承接 bakeoff/geospatial 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

bakeoff/geospatial

最新稳定版本:1.0.0

Composer 安装命令:

composer require bakeoff/geospatial

包简介

CakePHP Behavior to simplify working with geospatial database columns

README 文档

README

CakePHP 5.1.0 introduced 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, 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

Install:

composer require bakeoff/geospatial

In your Table classes:

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

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

$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);

统计信息

  • 总下载量: 15
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2025-02-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固