13.4 GIDB GML Import and Export

  Previous section   Next section

GML represents a continuation of the OpenGIS Consortium's work in interoperable geoprocessing through interface specifications. GML is an XML extension that allows developers to encode geographic information for both transfer and storage. The XML base provides a means to separate the actual geographic data from the representation or visualization of the data, and ensures that the data is accessible by a large variety of software systems. GML is comprised of three base XML schema documents: general feature-property model (feature.xsd), detailed geometry components (geometry.xsd), and XLink attributes (xlinks.xsd). An application schema is needed to declare the application-specific feature types that are derived from types in the standard GML schemas.

The GIDB System now has the ability to export any of the available vector data to GML in the form of an instance document (.XML) with a corresponding application schema document (.XSD). The GML application schema developed for the GIDB System was written to be flexible enough to include any point, line, or area vector features with the ability to add more complex vector types in the future. The application schema will be the same for all GML exports, but clearly the instance document will be specific to the data set that was exported. The GIDB System's ability to import GML data is still a work in progress and will be completed in the near future.

We will now describe the design behind the application schema document with target namespace, "gidb." Namespaces are case sensitive and used to provide a container for names used in XML. For example, "gml:AbstractFeatureType" is the syntax used to represent the element "AbstractFeatureType" that is defined in the GML namespace, "gml." Our GML application schema vector features were designed to be a good fit with the existing vector feature objects in the database interface module of the GIDB System as shown in Table 13.1.

The root element in the gidb namespace is FeatureCollection, which is derived from gml:AbstractFeatureCollectionType. gidb:FeatureCollection contains gml namespace elements description, name, boundedBy, and zero or more featureMembers as shown in Figure 13.10.

Figure 13.10. FeatureCollection Content Model

graphics/13fig10.gif

The feature type gidb:VectorFeatureType, derived from gml:AbstractFeatureType, is the base for the concrete feature types PointFeatureType, LineFeatureType, and AreaFeatureType (all in the gidb namespace). The gidb:VectorFeatureType contains zero or more abstract gidb:_featureAttribute elements as well as the gml: AbstractFeatureType elements it inherits (see Figure 13.11). The gidb:_featureAttribute elements are used to describe the feature attribute name and value pairs for a feature as in the fragment of GML instance code from the gidb namespace shown in Listing 13.6.

Figure 13.11. VectorFeatureType Content Model

graphics/13fig11.gif

Listing 13.6 Fragment of GML Instance Code
<featureAttributeInteger>
  <featureAttributeName>Population</featureAttributeName>
  <featureAttributeValue>45000</featureAttributeValue>
</featureAttributeInteger>

The use of substitution groups with feature attributes simplifies content models and allows us to substitute the abstract gidb:_featureAttribute with concrete subtypes. The head of the substitution group is gidb:_featureAttribute, and featureAttributeString, featureAttribute-Integer, featureAttributeDecimal, and featureAttributeDate are the members (all in the gidb namespace). This means that any of the members of the substitution group can be substituted in place of the head.

The XML code shown in Listing 13.7, taken from our gidb namespace application schema gidb.xsd, shows how the feature attributes with string or integer values are defined and included in the base feature type gidb:VectorFeatureType. The feature attribute types for decimal and date, omitted in Listing 13.7, are defined in the same manner as strings and integers.

Listing 13.7 XML Code from gidb Namespace
<element name="_featureAttribute"
type="gidb:AbstractFeatureAttributeType" abstract="true"/>

<element name="featureAttributeString" type=
"gidb:FeatureAttributeStringType"
substitutionGroup="gidb:_featureAttribute"/>

<complexType name="VectorFeatureType">
  <complexContent>
    <extension base="gml:AbstractFeatureType">
      <sequence>
        <element ref="gidb:_featureAttribute" minOccurs="0"  maxOccurs="unbounded"/>
      </sequence>
    </extension>
  </complexContent>
</complexType>

<complexType name="AbstractFeatureAttributeType" abstract="true">
  <sequence>
    <element name="featureAttributeName" type="string"/>
    <element name="featureAttributeValue" type="anySimpleType"/>
  </sequence>
</complexType>

<complexType name="FeatureAttributeStringType">
  <complexContent>
    <restriction base="gidb:AbstractFeatureAttributeType">
      <sequence>
        <element name="featureAttributeName" type="string"/>
        <element name="featureAttributeValue" type="string"/>
      </sequence>
    </restriction>
  </complexContent>
</complexType>

<complexType name="FeatureAttributeIntegerType">
  <complexContent>
    <restriction base="gidb:AbstractFeatureAttributeType">
      <sequence>
        <element name="featureAttributeName" type="string"/>
        <element name="featureAttributeValue" type="integer"/>
      </sequence>
    </restriction>
  </complexContent>
</complexType>

Types defined in the gidb namespace PointFeatureType, LineFeatureType, and AreaFeatureType extend VectorFeatureType by appending GML-specific geometry properties. PointFeatureType adds the element gml:pointProperty; LineFeatureType adds the elements gml:lineStringProperty and gml:multiLineStringProperty; and AreaFeatureType adds the elements gml:polygonProperty and gml:multiPolygonProperty to describe the geometry of the associated point, line, or area feature. The geometry elements of PointFeatureType are shown in Figure 13.12.

Figure 13.12. PointFeatureType Content Model (geometry only)

graphics/13fig12.gif

The GIDB System's GML export capability adds yet another way that we can interchange data with other standard GIS applications. Also, this use of industry- standard XML encoding in GML to transport and store geographic features opens up large stores of diverse data types to customers locally and throughout the world.


Top

Part IV: Applications of XML