Spatial Engine PostGIS
A spatial engine provides access to a service that can perform spatial operations, one of the available spatial engines is for PostGIS.
ESRI GeoDatabase enabled Postgres databases are not supported by Weave as a spatial engine. If access is required it will have to be via ArcGis server.
Weave does not currently support the PostGIS geography column type.
Namespace
urn:com.cohga.server.spatial.geotools#1.0
Tags
spatialengine
Properties
Name | Type | Required | Description |
---|---|---|---|
id | string | yes | Unique identifier |
dbtype | 'postgis' | yes | The name of the driver to use, in this case PostGIS |
host | string | yes | The hostname or ip address of the server |
port | number | yes | The port number that the instance is running on |
database | string | yes | The database to connected to |
schema | string | no | The default schema to connected to, default is 'public' |
user | string | no | The userid used when connecting to the database |
passwd | string | no | The password used when connecting to the database |
minconnections | integer | no | The minimum number of connections to open to the database |
maxconnections | integer | no | The maximum number of connections to open to the database |
validateconnections | boolean | no | Should database connections be checked on each access to see if they're still valid |
namespace | string | no | The namespace prefix |
loosebox | boolean | no | If set to 'true' if the Bounding Box should be 'loose', faster but not as deadly accurate |
estimatedextent | boolean | no | set to true if the bounds for a table should be computed using the 'estimated_extent' function, but beware that this function is less accurate, and in some cases * far* less accurate if the data within the actual bounds does not follow a uniform distribution. It also relies on the fact that you have accurate table stats available. So it is a good idea to 'VACUUM ANALYZE' the postgis table |
Sub-tags
None
Content
None
Examples
Basic PostGIS connection
<spatial:spatialengine id="postgis">
<dbtype>postgis</dbtype>
<host>mysqlhost</host>
<port>5432</port>
<database>spatial</database>
<user>gis</user>
<passwd>hak0rz</passwd>
</spatial:spatialengine>
Primary Key Table
For specifying primary key columns when Weave/GeoTools can not determine it directly.
SQL create statement for gt_pk_metadata table
CREATE TABLE gt_pk_metadata (
table_schema VARCHAR(32),
table_name VARCHAR(32) NOT NULL,
pk_column VARCHAR(32) NOT NULL,
pk_column_idx INTEGER,
pk_policy VARCHAR(32),
pk_sequence VARCHAR(64),
unique (table_schema, table_name, pk_column),
check (pk_policy in ('sequence', 'assigned', 'autogenerated'))
)
Column | Description |
---|---|
table_schema | Name of the database schema in which the table is located. |
table_name | Name of the table to be published |
pk_column | Name of a column used to form the feature IDs |
pk_column_idx | Index of the column in a multi-column key. In case multi column keys are needed multiple records with the same table schema and table name will be used. |
pk_policy | The new value generation policy, used in case a new feature needs to be added in the table ('assigned', 'sequence' or 'autogenerated'). Where: |
pk_sequence | The name of the database sequence to be used when generating a new value for the pk_column. The pk_sequence value only need to be set if the pk_policy is 'sequence'. |
Using primary key metadata configuration
You can also specify the above information directly in the spatial engine configuration.
Name | Description |
---|---|
name | The table name |
schema | The optional table schema |
column | The column in the the table that contains the unique id |
policy | How the key is generated |
sequence | The name of the database sequence to use if the policy is 'sequence' |
Using primary key metadata
<spatial:spatialengine id="postgis">
<dbtype>postgis</dbtype>
<host>mysqlhost</host>
<port>5432</port>
<database>spatial</database>
<user>gis</user>
<passwd>hak0rz</passwd>
<primarykeymetadata>
<table name="park" column="gid" policy="autogenerated"/>
<table name="property" column="park_id" type="autogenerated"/>
<table name="road" column="objectid" type="autogenerated"/>
</primarykeymetadata>
</spatial:spatialengine>
Using geometry metadata configuration
As of Weave 2.5.16 it's possible to specify the information contained in the geometry metadata table directly in the spatial engine configuration.
Name | Description |
---|---|
name | The table name |
schema | The optional table schema |
type | The geometry type (point, linestring, polygon, multipoint, multilinestring, multipolygon) |
srid | The geometry srid |
dimension | The geometry dimension |
Using geometry metadata table
<spatial:spatialengine id="postgis">
<dbtype>postgis</dbtype>
<host>mysqlhost</host>
<port>5432</port>
<database>spatial</database>
<user>gis</user>
<passwd>hak0rz</passwd>
<geometrymetadata>
<table schema="public" name="park" type="multipolygon" srid="28355" dimension="2"/>
<table schema="public" name="property" type="polygon" srid="28355" dimension="2"/>
<table schema="public" name="road" type="linestring" srid="28355" dimension="2"/>
</geometrymetadata>
</spatial:spatialengine>