Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
xml
xml
titleBasic SQL Server connection
<spatial:spatialengine id="sqlserver">
  <dbtype>sqlserver</dbtype>
  <host>sqlhost</host>
  <port>1434</port>
  <user>gis</user>
  <passwd>hak0rz</passwd>
  <schema>GIS</schema>
  <minconnection>2</minconnections>
  <validateconnections>true</validateconnections>
</spatial:spatialengine>

Row Identifiers

Weave needs to be able to uniquely identify each row in a particular table, normally it would do this using the primary key of the table, but something a primary key has not been specified so this information must be provided another way.

This can be done by creating a primary key metadata table and populating it with a row for each table that will be exposed to Weave and then setting the {{primarykeymetadatatable}} attribute for the spatial engine. 

Code Block
languagesql
titleSQL create statement for gt_pk_metadata table
CREATE TABLE GT_PK_METADATA (
  TABLE_SCHEMA varchar(255) NOT NULL,
  TABLE_NAME varchar(255) NOT NULL,
  PK_COLUMN varchar(255) NOT NULL,
  PK_COLUMN_IDX int NOT NULL,
  PK_POLICY varchar(255) NOT NULL,
  PK_SEQUENCE varchar(255),
   UNIQUE(TABLE_SCHEMA, TABLE_NAME, PK_COLUMN),
   CHECK(PK_POLICY IN ('ASSIGNED','SEQUENCE', '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').

pk_sequence

The name of the database sequence to be used when generating a new value for the pk_column.

Using the geometry metadata table

The SQL server data store can determine the geometry type and native SRID of a particular column only by data inspection, by looking at the first row in the table. Of course this is error prone, and works only if there is data in the table. The administrator can address the above issue by manually creating a geometry metadata table describing each geometry column. Its presence is indicated via the SQL Server datastore connection parameter named geometrymetadatatable (which may be a simple table name or a schema-qualified one). The table has the following structure (the table name is flexible, just specify the one chosen in the data store connection parameter):

...