Download the PHP package yii2-extensions/postgis without Composer
On this page you can find all versions of the php package yii2-extensions/postgis. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download yii2-extensions/postgis
More information about yii2-extensions/postgis
Files in yii2-extensions/postgis
Package postgis
Short Description Yii2-extension to work with postgis data
License BSD-3-Clause
Homepage https://github.com/yii2-extensions/postgis
Informations about the package postgis
Yii2 Postgis
Extension for working with Postgis. As intermediate format used Geo Json.
Installing
The preferred way to install this extension is through Composer.
GeometryBehavior
Converts coordinates array to SQL expression for saving in postgis binary format before insert/update and from postgis binary to array after find.
Option | Type | Default | Description |
---|---|---|---|
attribute | string | attribute that will be automatically handled | |
type | string | geometry type: Point , LineString , Polygon , MultiPoint , MultiLineString , MultiPolygon |
|
skipAfterFindPostgis | boolean | false | skip convertion after find, if data in postgis binary (it requires a separate query, look PostgisQueryTrait ) |
StBufferBehavior
Generate SQL expression before insert/update based on geometry and radius
Option | Type | Default | Description |
---|---|---|---|
attribute | string | attribute for saving buffer | |
attributeGeometry | string | attribute with geometry | |
attributeRadius | string | attribute with radius | |
geography | boolean | false | build buffer as geography |
radiusUnit | string | deg for geomtery or m for geography |
units of buffer radius: deg , m , km |
options | array | [] | additional options for St_Buffer function |
PostgisQueryTrait
Extends ActiveQuery for working with Postgis data.
Option | Type | Default | Description |
---|---|---|---|
autoGeoJson | boolean | true | select all geo columns as GeoJson automatically |
geoFields | array | all table columns with data type geometry or geography |
table columns, that must be selected as Geo Json |
exceptGeoFields | boolean | false | exclude all geo columns from select statement |
exceptFields | array | [] | columns, which must be excluded from select statement |
Method | Description |
---|---|
withGeoFields($fields=null) | Add columns, that must be selected as Geo Json. Accepts null , string , array . If fields is null - all geoFileds will be added. |
excludeFields($fields=null) | Exclude columns from select statement. Accepts null , string , array . If fields is null - all exceptFields will be excluded from select statement. |
GeoJsonHelper
Helper for working with Geo Json
Method | Returns | Description |
---|---|---|
toArray($geoJson) | array | returns coordinates array by Geo Json |
toGeoJson($type, $coordinates, $srid=4326) | string (geo json) | returns Geo Json by geometry type, coordinates array and SRID |
toGeometry($type, $coordinates, $srid=4326) | string (sql expression) | the same, that toGeoJson , but wraps result by "ST_GeomFromGeoJSON('$geoJson')" |
CREDITS
This extension was forked and lives here to keep going great work in keeping with Yii2 community open source spirit. Find Original code at https://github.com/nanson/yii2-postgis