perspectivain/php-postgis

一个PHP特性,用于将Postgis坐标转换为数组,以及将PHP数组转换为Postgis文本

dev-master 2015-10-28 12:54 UTC

This package is not auto-updated.

Last update: 2024-09-28 16:25:53 UTC


README

一个PHP特性,用于将Postgis坐标转换为数组,以及将PHP数组转换为Postgis文本。

目前支持 PointPolygon 类型。

用法

将其作为 PHP特性 使用。

<?php
use perspectivain\postgis\PostgisTrait;

class Customer extends ActiveRecord
{
    use PostgisTrait;
    ...
}

...

$coordinates = $model->WktToArray('Polygon', 'city_coordinates');

$model->city_coordinates = $model->arrayToWkt('Polygon', $coordinates);

安装

通过Composer安装此扩展是首选方式。

{
  "require": {
    "perspectivain/php-postgis": "*"
  }
}