Feature store configuration in deegree 3.0
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 in deegree version 3.0
1. PostGIS feature stores
A <PostGISFeatureStore> is a feature store that is backed by a PostgreSQL/PostGIS database.
Current version postgis: 3.0.0 (valid since 2010-11-15)
(elements marked with "choice": one of these elements may be provided.)
List of supported attributes and elements for <PostGISFeatureStore>:
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.
JDBCConnId: mandatory. The identifier (file base name) of the database connection as string (see JDBC configuration).
postgisfs:FeatureType (choice): optional, unbounded. see below.
BLOBMapping (choice). see below.
List of supported attributes and elements for <BLOBMapping>:
StorageCRS: mandatory.The coordinate reference system (CRS) of the features in the storage.
GMLSchema: mandatory, unbounded. File / directory of GML schema to use.
version (attribute): mandatory. Possible values are: GML_2, GML_30, GML_31, GML_32.
NamespaceHint: optional, unbounded.
prefix (attribute): mandatory. An identifying prefix as string.
namespaceURI (attribute): mandatory. The namespace as string.
postgisfs:FeatureType: optional, unbounded. see below.
List of supported attributes and elements for <postgisfs:FeatureType>:
name (attribute): mandatory. Qualified name of the feature type. (If omitted, it is derived from the table name).
table (attribute): mandatory. Table that the feature type is mapped to.
postgisfs:FIDMapping: optional. see below.
postgisfs:AbstractProperty: optional, unbounded. see below.
List of supported attributes and elements for <postgisfs:FIDMapping>:
Column:
name (attribute): mandatory. The name of the column as string.
type (attribute): optional. Possible values are: string, boolean, decimal, double, integer, date, dateTime, time.
postgisfs:AbstractIDGenerator: possible values are: AutoIdGenerator, UUIDGenerator, SequenceIDGenerator.
List of supported attributes and elements for <postgisfs:AbstractProperty>:
name (attribute): optional. Qualified name of the property (if omitted, it is derived from the mapping column).
minOccurs (attribute): optional. The minimum non-negative number of times that this property is required in feature instances.
maxOccurs (attribute): optional. The maximum positive number of times that this property is permitted in feature instances.
mapping (attribute): optional. Mapping of the property (currently, this can only be the name of a column).
nilMapping (attribute): optional. Boolean column that stores whether the property is nilled.
JoinedTable: Defines a 1:n mapping in the relational schema.
indexColumn (attribute): optional. Name of the column that stores the index of the related object.
1.1. PostGIS examples
1.1.1. PostGIS relational table example
Minimal configuration (just table), with implicit namespace (xmlns:app="http://www.deegree.org/app") and automatic property mapping (for all table fields)
<PostGISFeatureStore
configVersion="3.0.0"
xmlns="http://www.deegree.org/datasource/feature/postgis"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.deegree.org/datasource/feature/postgis http://schemas.deegree.org/datasource/feature/postgis/3.0.0/postgis.xsd">
<!-- [1] Identifier of JDBC connection -->
<JDBCConnId>postgis</JDBCConnId>
<!-- [0...n] Definitions of feature types (derived from tables) -->
<!-- Config option 1: Minimal configuration (just table) -->
<!-- Implicit namespace (xmlns:app="http://www.deegree.org/app"), automatic property mapping (all table fields) -->
<FeatureType table="country" />
</PostGISFeatureStore>
Configuration based on table and explicit name (without namespace)
<PostGISFeatureStore
configVersion="3.0.0"
xmlns="http://www.deegree.org/datasource/feature/postgis"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.deegree.org/datasource/feature/postgis http://schemas.deegree.org/datasource/feature/postgis/3.0.0/postgis.xsd">
<!-- [1] Identifier of JDBC connection -->
<JDBCConnId>postgis</JDBCConnId>
<!-- [0...n] Definitions of feature types (derived from tables) -->
<!-- Config option 2: Configuration based on table and explicit name -->
<FeatureType table="country" name="Country" />
</PostGISFeatureStore>
Configuration based on table and explicit name with namespace
<PostGISFeatureStore
configVersion="3.0.0"
xmlns="http://www.deegree.org/datasource/feature/postgis"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.deegree.org/datasource/feature/postgis http://schemas.deegree.org/datasource/feature/postgis/3.0.0/postgis.xsd">
<!-- [1] Identifier of JDBC connection -->
<JDBCConnId>postgis</JDBCConnId>
<!-- [0...n] Definitions of feature types (derived from tables) -->
<!-- Config option 3: Configuration based on table and explicit name with namespace-->
<FeatureType xmlns:myapp="http://www.deegree.org/myapp" table="country2" name="myapp:Country" />
</PostGISFeatureStore>
Configuration based on table and explicit name with namespace and explicit property mapping
<PostGISFeatureStore
configVersion="3.0.0"
xmlns="http://www.deegree.org/datasource/feature/postgis"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.deegree.org/datasource/feature/postgis http://schemas.deegree.org/datasource/feature/postgis/3.0.0/postgis.xsd">
<!-- [1] Identifier of JDBC connection -->
<JDBCConnId>postgis</JDBCConnId>
<!-- [0...n] Definitions of feature types (derived from tables) -->
<!-- Config option 4: Configuration based on table and explicit name with namespace and explicit property mapping -->
<FeatureType xmlns:myapp="http://www.deegree.org/myapp" table="country2" name="myapp:Country">
<SimpleProperty mapping="prop1" />
<GeometryProperty mapping="the_geom" />
</FeatureType>
</PostGISFeatureStore>
Configuration based on table and explicit name with namespace and explicit property mapping, specifying CRS
<PostGISFeatureStore
configVersion="3.0.0"
xmlns="http://www.deegree.org/datasource/feature/postgis"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.deegree.org/datasource/feature/postgis http://schemas.deegree.org/datasource/feature/postgis/3.0.0/postgis.xsd">
<!-- [1] Identifier of JDBC connection -->
<JDBCConnId>postgis</JDBCConnId>
<!-- [0...n] Definitions of feature types (derived from tables) -->
<!-- Config option 5: Configuration based on table and explicit name with namespace and explicit property mapping, specifying CRS -->
<FeatureType xmlns:myapp="http://www.deegree.org/myapp" table="country2" name="myapp:Country">
<SimpleProperty mapping="prop1" name="myapp:property1" />
<GeometryProperty mapping="the_geom" name="myapp:the_geom" crs="EPSG:4326" srid="-1" />
</FeatureType>
</PostGISFeatureStore>
Configuration based on table and explicit name with namespace and explicit property mapping, specifying CRS
<PostGISFeatureStore
configVersion="3.0.0"
xmlns="http://www.deegree.org/datasource/feature/postgis"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.deegree.org/datasource/feature/postgis http://schemas.deegree.org/datasource/feature/postgis/3.0.0/postgis.xsd">
<!-- [1] Identifier of JDBC connection -->
<JDBCConnId>postgis</JDBCConnId>
<!-- [0...n] Definitions of feature types (derived from tables) -->
<!-- Config option 6: Configuration based on table and explicit name with namespace and explicit property mapping, specifying CRS -->
<!-- If FID can not be detected by deegree (default: searching for first auto increment field) a field must be specified. An ID generator must
also be declared -->
<FeatureType xmlns:myapp="http://www.deegree.org/myapp" table="country2" name="myapp:Country">
<FIDMapping>
<Column name="objectid"></Column>
<AutoIdGenerator></AutoIdGenerator>
</FIDMapping>
<SimpleProperty mapping="prop1" name="myapp:property1" />
<GeometryProperty mapping="the_geom" name="myapp:the_geom" crs="EPSG:4326" srid="-1" />
</FeatureType>
</PostGISFeatureStore>
1.1.2. PostGIS Blob example
<PostGISFeatureStore
configVersion="3.0.0"
xmlns="http://www.deegree.org/datasource/feature/postgis"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.deegree.org/datasource/feature/postgis http://schemas.deegree.org/datasource/feature/postgis/3.0.0/postgis.xsd">
<!-- [1] Identifier of JDBC connection -->
<JDBCConnId>postgis</JDBCConnId>
<!-- [1] CRS for storing geometries -->
<StorageCRS>EPSG:4326</StorageCRS>
<!-- [0...n] GML schema file / directory to be used -->
<GMLSchema gmlVersion="GML_32">...</GMLSchema>
<!-- [0...n] Prefixes to use for exporting qualified elements (features / properties) -->
<NamespaceHint namespaceURI="app" prefix="http://www.deegree.org/app" />
</PostGISFeatureStore>
2. Oracle feature stores
An <OracleFeatureStore> is a feature store that is backed by an Oracle Spatial database.
Current Version oracle: under development.
In the meantime, for some use cases the SimpleSQL feature store might be used. See HowTo: add SimpleSQL feature store for details.
2.1. Oracle example
3. 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.
3.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, asbinary(the_geom)
FROM some_table
WHERE the_geom && 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, asbinary(st_simplifypreservetopology(the_geom, 1))
FROM some_table
WHERE the_geom && st_geomfromtext(?, -1)
</LODStatement>
<LODStatement aboveScale="6000">
SELECT name, title, asbinary(st_simplify(the_geom, 30))
FROM some_table
WHERE the_geom && 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>
4. 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.
4.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>
4.2. 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.
4.3. 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>
Further information
Learn how to add a new shape feature store, PostGIS feature store or SimpleSQL feature store with the easy to use services console.
For other parts of the workspace configuration please consult the following pages: