A PHP Trait to convert Postgis coordinates to array and a PHP array to Postgis text.
Currently supports Point
and Polygon
types.
Use it as PHP trait.
<?php
use perspectivain\postgis\PostgisTrait;
class Customer extends ActiveRecord
{
use PostgisTrait;
...
}
...
$coordinates = $model->WktToArray('Polygon', 'city_coordinates');
$model->city_coordinates = $model->arrayToWkt('Polygon', $coordinates);
The preferred way to install this extension is through Composer.
{
"require": {
"perspectivain/php-postgis": "*"
}
}