Version 3 (modified by ashaon, 13 years ago) (diff)


GeoServer? "Complex DataStore/Community? Schema": User Manual

The objective of this document is to provide guidelines for creating and defining a FeatureType? that is to be exposed by the “Community Schema” version of Geoserver. In summary, this special version of Geoserver facilitates serving up data from a relational database, in an externally defined schema, which exists independently of the underlying data structure of the database. In order to achieve this feat, Geoserver requires the followings:

  1. An output (community) schema. This schema may exist independently of the actual data so it will be loaded from a schema file, defined in XML Schema language.
  2. An input FeatureType?. Geoserver FeatureTypes? are exposed by Geoserver DataStores?, so a suitable way is needed to specify the DataStore?'s connection parameters and the source FeatureType? name.
  3. The attribute and attribute id mapping definitions. They consist of a series of couples of XPath OGC Filter 1.0 Expressions. The former addresses the output schema properties and the later defines how the value of that properties are derived from the source Feature instances.

All this information is held by a FeatureTypeMapping? object, and a ComplexDataStore?, in turn, may hold an arbitrary number of that objects, each defining a FeatureType? that the DataStore? exposes.

Geoserver uses an XML file which contains these definitions, and whose location in the form of an URL must be used to create a DataStore? instance through the GeoTools? DataStoreFinder? lookup system. This document presents detailed instructions for creating these definitions, specifying database connection parameters along with other necessary configuration related aspects of exposing a FeatureType? through Geoserver.

1. Creating a New Feature Type

Followings are the steps for creating a new FeatureType? in the "Community Schema" version of Geoserver:

  1. Create a new folder in Geoserver Data Directory -> featureType folder (Figure 1). This folder will contain all file necessary to define a new Feature Type. The name of the folder may be anything but ideally it should be the same as the name of the Feature Type that it is intended for.
  2. Create an XML document called “info.xml” (case-sensitive) in the newly created folder. This file contains a formal definition of a Feature Type. Information provided in this file is also used by the GetCapabilities? request to Geoserver, to provide a brief overview of a FeatureType?. The structure of “info.xml” is described in section 4.
  3. Create an XML document containing the mappings between source features and target features of the FeatureType? being defined. The name of this XML file could be anything. The structure of this mapping file is described in section 5.
  4. The schema file along with other schemas that it depends on (unless they are referenced via URLs in the schema) that the XML output of a FeatureType? conforms to may also be placed in this folder. However, it is recommended to keep the schemas used for all FeatureTypes? exposed by Geoserver under the commonSchemas folder (Figure 1) in Georserver’s Data Directory.