Locked History Actions

deegree3/WorkspaceConfiguration/FeatureStoreConfiguration_3.1

Feature store configuration (workspace/datasources/feature)

First ideas on the configuration concept for all types of datasources and datastores are described in the deegree3/DatastoreConfigurationConcepts.

This page describes the configuration of feature stores with deegree version 3.1

0.1. SQL feature stores

A <SQLFeatureStore> is a feature store that is backed by an SQL database.
Current version sql: 3.1.0

(elements marked with "choice": one of these elements may be provided.)

List of supported attributes and elements for <SQLFeatureStore>:

  • configVersion (attribute): mandatory. Currently, this always has to be 3.0.0

TODO

0.2. SimpleSQL feature stores

A <SimpleSQLFeatureStore> is a feature store for generic spatial databases. Configuration is based on SQL statements.
Current version simplesql: 3.0.0/simplesql.xsd (configuration schema valid since 2010-11-15)

List of supported attributes and elements:

  • configVersion (attribute): mandatory. Currently, this always has to be 3.0.0

  • StorageCRS: optional (default: EPSG:4326). Coordinate reference system (CRS) of the stored geometries.

  • FeatureTypeName: optional (default: 'Feature'). Local name of the feature type.

  • FeatureTypeNamespace: optional (default: 'http://www.deegree.org/app'). Namespace of the feature type.

  • FeatureTypePrefix: optional (default: 'app'). Prefix of the feature type.

  • ConnectionPoolId: mandatory. The identifier (file name) of the database connection. See JDBC configuration.

  • SQLStatement: mandatory. SQL-SELECT that retrieves the features. The selected columns are used for the properties of the features, the geometry column must be selected as WKB. The WHERE-clause must contain a BBOX expression with a "?" (which will be replaced by the BBOX geometry constraint written as WKT). In order to find the correct SQL statement for your use-case, it is recommended to create an SQL statement (without the WHERE clause) manually and first test it via a standard SQL client (e.g. pgadmin for PostGIS). Only if this works (and you're satisfied with the selected columns), add the WHERE-clause, perform XML-encoding if needed (or simply put your statement in <[CDATA[...]]>) and use it for the SQLStatement element.

  • BBoxStatement: mandatory. SQL-SELECT that retrieves the bounding box of the features. The returned value must be a WKT-encoded envelope.

  • LODStatement: optional, unbounded. statement for specific WMS scale ranges (and thus the level of detail LOD).

    • aboveScale (attribute): mandatory. If the current scale is above the given value, this LODStatement will be used.

0.2.1. SimpleSQL examples

This example is for PostGIS. Note that the bounding box operator (&&) has been XML-encoded.

<SimpleSQLFeatureStore
  configVersion="3.0.0"
  xmlns="http://www.deegree.org/datasource/feature/simplesql"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.deegree.org/datasource/feature/simplesql http://schemas.deegree.org/datasource/feature/simplesql/3.0.0/simplesql.xsd">

  <!-- [1] CRS for storing geometries -->
  <StorageCRS>EPSG:4326</StorageCRS>

  <!-- [0...1] Local name of the feature type (defaults to 'Feature') -->
  <FeatureTypeName>MyFeature</FeatureTypeName>

  <!-- [0...1] Namespace of the feature type (defaults to NULL namespace) -->
  <FeatureTypeNamespace>http://www.deegree.org/app</FeatureTypeNamespace>

  <!-- [0...1] Prefix of the feature type (defaults to auto-generated prefix) -->
  <FeatureTypePrefix>app</FeatureTypePrefix>

  <!-- [1] database connection -->
  <ConnectionPoolId>connid</ConnectionPoolId>

  <!-- [1] query statement -->
  <SQLStatement>
    SELECT name, title AS "Titel", asbinary(the_geom)
    FROM some_table
    WHERE the_geom &amp;&amp; st_geomfromtext(?, -1)
  </SQLStatement>

  <!-- [1] bounding box statement -->
  <BBoxStatement>
    SELECT astext(ST_Estimated_Extent('some_table', 'the_geom')) as bbox
  </BBoxStatement>

  <!-- [0..n] different statements for specific WMS scale ranges -->
  <LODStatement aboveScale="3000">
    SELECT name, title AS "Titel", asbinary(st_simplifypreservetopology(the_geom, 1))
    FROM some_table
    WHERE the_geom &amp;&amp; st_geomfromtext(?, -1)
  </LODStatement>
  <LODStatement aboveScale="6000">
    SELECT name, title AS "Titel", asbinary(st_simplify(the_geom, 30))
    FROM some_table
    WHERE the_geom &amp;&amp; st_geomfromtext(?, -1) and not st_isempty(st_simplify(the_geom, 30))
  </LODStatement>
</SimpleSQLFeatureStore>

This example is for MySQL. Note that the BBoxStatement is not optimal, as the extent of all polygons is not derived with DB funcitons.

<SimpleSQLFeatureStore
 configVersion="3.0.0"
 xmlns="http://www.deegree.org/datasource/feature/simplesql"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://www.deegree.org/datasource/feature/simplesql http://schemas.deegree.org/datasource/feature/simplesql/3.0.0/simplesql.xsd">

  <!-- [1] CRS for storing geometries -->
  <StorageCRS>EPSG:26912</StorageCRS>

  <!-- [0...1] Local name of the feature type (defaults to 'Feature') -->
  <FeatureTypeName>LandslideAreas</FeatureTypeName>

  <!-- [0...1] Namespace of the feature type (defaults to NULL namespace) -->
  <FeatureTypeNamespace>http://www.deegree.org/app</FeatureTypeNamespace>

  <!-- [0...1] Prefix of the feature type (defaults to auto-generated prefix) -->
  <FeatureTypePrefix>app</FeatureTypePrefix>

  <!-- [1] database connection -->
  <ConnectionPoolId>mysql</ConnectionPoolId>

  <!-- [1] query statement -->
  <SQLStatement>
    SELECT code, type, status, shape_leng, shape_area, asbinary(SHAPE) AS geom
    FROM landslides
    WHERE MBRIntersects(GeomFromText(?),SHAPE)
  </SQLStatement>

  <!-- [1] bounding box statement -->
  <BBoxStatement>
    SELECT 'POLYGON((199709.85678244993 4088920.4794775285,199709.85678244993 4644250.101781303,736495.959185044 4644250.101781303,736495.959185044 4088920.4794775285,199709.85678244993 4088920.4794775285))' AS bbox
  </BBoxStatement>

</SimpleSQLFeatureStore>

This example is for Oracle Spatial.

<SimpleSQLFeatureStore
 configVersion="3.0.0"
 xmlns="http://www.deegree.org/datasource/feature/simplesql"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://www.deegree.org/datasource/feature/simplesql http://schemas.deegree.org/datasource/feature/simplesql/3.0.0/simplesql.xsd">

  <!-- [1] CRS for storing geometries -->
  <StorageCRS>EPSG:26912</StorageCRS>

  <!-- [0...1] Local name of the feature type (defaults to 'Feature') -->
  <FeatureTypeName>LandslideAreas</FeatureTypeName>

  <!-- [0...1] Namespace of the feature type (defaults to NULL namespace) -->
  <FeatureTypeNamespace>http://www.deegree.org/app</FeatureTypeNamespace>

  <!-- [0...1] Prefix of the feature type (defaults to auto-generated prefix) -->
  <FeatureTypePrefix>app</FeatureTypePrefix>

  <!-- [1] database connection -->
  <ConnectionPoolId>oracle</ConnectionPoolId>

  <!-- [1] query statement -->
  <SQLStatement>
    SELECT name, title, sdo_util.to_wkbgeometry(GEOMETRY) as geom
    FROM from some_table
    WHERE SDO_RELATE(GEOMETRY,SDO_GEOMETRY(?, 26912),'mask=anyinteract querytype=WINDOW') = 'TRUE'
  </SQLStatement>

  <!-- [1] bounding box statement -->
  <BBoxStatement>
    SELECT sdo_util.to_wktgeometry(sdo_root_mbr) as bbox from USER_SDO_INDEX_METADATA where sdo_index_name = 'YOUR_SPATIAL_INDEX_SPIDX'
  </BBoxStatement>

0.3. Shape feature stores

A <ShapeFeatureStore> is a feature store that is backed by a shape file.
Current Version shape: 3.0.0/shape.xsd (valid since 2010-11-15)

List of supported attributes and elements:

  • configVersion (attribute): mandatory. Currently, this always has to be 3.0.0

  • StorageCRS: optional (default: EPSG:4326).Coordinate reference system (CRS) of the features in the shape file.

  • FeatureTypeName: optional (default: base name of the shape file). Local name of the feature type as string.

  • FeatureTypeNamespace: optional (default: NULL namespace). Namespace of the feature type as string.

  • FeatureTypePrefix: optional (default: auto-generated prefix).A prefix of the feature type to represent the namespace.

  • File: mandatory. Name and relative path to the shape file as string.

  • Encoding: optional. Encoding of the shape file text fields as string (e.g. ISO-8859-1).

  • GenerateAlphanumericIndexes: optional (default: true). Possible values: true, false.

    • true = an alphanumerical index will be created.
      false = an alphanumerical index will not be created.

0.3.1. Shape example

<ShapeFeatureStore
  configVersion="3.0.0"
  xmlns="http://www.deegree.org/datasource/feature/shape"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.deegree.org/datasource/feature/shape http://schemas.deegree.org/datasource/feature/shape/3.0.0/shape.xsd">

  <!-- [0...1] CRS for storing geometries -->
  <StorageCRS>EPSG:4326</StorageCRS>

  <!-- [0...1] Local name of the feature type (defaults to base name of shape file) -->
  <FeatureTypeName>Shape</FeatureTypeName>

  <!-- [0...1] Namespace of the feature type (defaults to NULL namespace) -->
  <FeatureTypeNamespace>http://www.deegree.org/app</FeatureTypeNamespace>

  <!-- [0...1] Prefix of the feature type (defaults to auto-generated prefix) -->
  <FeatureTypePrefix>app</FeatureTypePrefix>

  <!-- [1] Name of the shape file -->
  <File>...</File>

  <!-- [0...1] Encoding of the text fields -->
  <Encoding>ISO-8859-1</Encoding>

  <!-- [0...1] Should an index for alphanumeric fields be generated -->
  <GenerateAlphanumericIndexes>false</GenerateAlphanumericIndexes>
</ShapeFeatureStore>

0.4. Memory feature store

A <MemoryFeatureStore> is a feature store that keeps all features in memory.
Current version memory: 3.0.0/memory.xsd (valid since 2010-11-15)

List of supported attributes and elements:

  • configVersion (attribute): mandatory. Currently, this always has to be 3.0.0

  • StorageCRS: optional (default: EPSG:4326).Coordinate reference system (CRS) of the features in the storage.

  • NamespaceHint: optional, unbounded.

    • prefix (attribute): mandatory. An identifying prefix as string.

    • namespaceURI (attribute): mandatory. Namespace as string.

  • GMLSchema: mandatory, unbounded. A relative path to the schema folder, starting at this configuration file.

    • version (attribute): mandatory. Possible values are: GML_2, GML_30, GML_31, GML_32.

  • GMLFeatureCollection: optional, unbounded. A relative path to the feature collection file, starting at this configuration file.

    • version (attribute): mandatory. Possible values are: GML_2, GML_30, GML_31, GML_32.

0.4.1. Memory example

<MemoryFeatureStore
  configVersion="3.0.0"
  xmlns="http://www.deegree.org/datasource/feature/memory"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.deegree.org/datasource/feature/memory http://schemas.deegree.org/datasource/feature/memory/3.0.0/memory.xsd">

  <!-- [1] CRS for storing geometries -->
  <StorageCRS>EPSG:4326</StorageCRS>

  <!-- [0...n] Prefixes to use for exporting qualified elements (features / properties) -->
  <NamespaceHint namespaceURI="app" prefix="http://www.deegree.org/app" />

  <!-- [1...n] GML schema file / directory to be used -->
  <GMLSchema version="GML_32">...</GMLSchema>

  <!-- [0...n] GML datasets to load on startup -->
  <GMLFeatureCollection version="GML_32">...</GMLFeatureCollection>
</MemoryFeatureStore>

1. Further information


CategoryDeegree3 CategoryWorkspaceConfiguration