Component Element BinaryEncoding Element
OGC 08-094r1 SWE Common Data Model
Requirement
http:www.opengis.netspecSWE2.0reqxsd-advanced-encodingsdatatype-valid
Req 82. The value of the “dataType” XML attribute of the “Component” element
shall be one of the URIs listed in Table 8.1.
These data types are specified in the normative table below:
Common Name
URI to use in “dataType” attribute Description
Signed Byte http:www.opengis.netdefdataTypeOGC0signedByte
8-bits signed binary integer. Range:
−128 to +127 Unsigned Byte
http:www.opengis.netdefdataTypeOGC0unsignedByte 8-bits unsigned binary integer.
Range: 0 to +255 Signed Short
http:www.opengis.netdefdataTypeOGC0signedShort 16-bits signed binary integer.
Range: −32,768 to +32,767
Unsigned Short http:www.opengis.netdefdataTypeOGC0unsignedShort
16-bits unsigned binary integer. Range: 0 to +65,535
Signed Int http:www.opengis.net defdataTypeOGC0signedInt
32-bits signed binary integer. Range:
−2,147,483,648 to +2,147,483,647 Unsigned Int
http:www.opengis.netdefdataTypeOGC0unsignedInt 32-bits unsigned binary integer.
Range: 0 to +4,294,967,295 Signed Long
http:www.opengis.netdefdataTypeOGC0signedLong 64-bits signed binary integer.
Range: −263 to +263 - 1
Unsigned Long http:www.opengis.netdefdataTypeOGC0unsignedLong
64-bits unsigned binary integer. Range: 0 to +264 - 1
Half Precision Float
http:www.opengis.net defdataTypeOGC0float16 16-bits single precision floating point number
as defined in IEEE 754. Float
http:www.opengis.netdefdataTypeOGC0float32 32-bits single precision floating point number
as defined in IEEE 754. Double
http:www.opengis.netdefdataTypeOGC0double or
http:www.opengis.netdefdataTypeOGC0float64 64-bits double precision floating point
number as defined in IEEE 754. Long Double
http:www.opengis.net defdataTypeOGC0float128 128-bits quadruple precision floating point
number as defined in IEEE 754. UTF-8 String
Variable Length http:www.opengis.netdefdataTypeOGC0string-utf-8
“byteLength” attribute is not set. Variable length string composed of a 2-bytes
unsigned short value indicating its length followed by a sequence of UTF-8 encoded
characters as specified by the Unicode Standard 2.5.
UTF-8 String Fixed Length
http:www.opengis.netdefdataTypeOGC0string-utf-8 “byteLength” attribute is set.
Fixed length string composed of a sequence of UTF-8 encoded characters as specified by
the Unicode Standard 2.5, and padded with 0 characters.
Table 8.1 – Allowed Binary Data Types
The data type should be chosen so that its range allows the encoding of all possible values for a field i.e. compatible with the field representation and constraints including
112
Copyright © 2011 Open Geospatial Consortium
SWE Common Data Model OGC 08-094r1
NIL values. This means that certain combinations of data type and components are not allowed. If a scalar component does not specify any constraint, any data type compatible
with its representation can be used and it is the responsibility of the implementation to insure that all future values for the component will “fit” in the data type.
Requirement
http:www.opengis.netspecSWE2.0reqxsd-advanced-encodingsdatatype-compatible
Req 83. The chosen data type shall be compatible with the scalar component
representation, constraints and NIL values.
Only data types marked with an asterisk allow the usage of the “byteLength” or “bitLength” attribute to customize their size. Usage of these attributes is forbidden on all
other data types since their size is fixed and already specified in this standard in the case of a variable length string, the size is included in the stream. This is enforced by a
Schematron pattern.
Requirement
http:www.opengis.netspecSWE2.0reqxsd-advanced-encodingsno-datatype-length
Req 84. The “bitLength” and “byteLength” XML attribute shall not be set when a
fixed size data type is used.
The value of the “byteEncoding” XML attribute allows the selection of either the ‘raw’ or ‘base64’ encoding methods. When ‘base64’ is selected each byte is converted to its base
64 representation before it is included in encoded block, making it possible to include the values directly inline in the XML instance.
The following binary encoded image data illustrates how the BinaryEncoding element is used to specify encoding options to each scalar value in the dataset:
swe:DataArray definition
= http:sweet.jpl.nasa.gov2.0info.owlRaster
swe:elementCount swe:Count
swe:value 256
swe:value swe:Count
swe:elementCount swe:elementType
name =
row swe:DataArray
definition =
http:sweet.jpl.nasa.gov2.0info.owlRow swe:elementCount
swe:Count swe:value
256 swe:value
swe:Count swe:elementCount
swe:elementType name
= pixel
swe:DataRecord definition
= http:sweet.jpl.nasa.gov2.0info.owlCell
swe:field name
= red
swe:Count definition
= http:sweet.jpl.nasa.gov2.0physRadiation.owlRadiance
swe:description Radiance measured on band1
swe:description swe:Count
swe:field swe:field
name =
green
Copyright © 2011 Open Geospatial Consortium
113
OGC 08-094r1 SWE Common Data Model
swe:Count definition
= http:sweet.jpl.nasa.gov2.0physRadiation.owlRadiance
swe:description Radiance measured on band2
swe:description swe:Count
swe:field swe:field
name =
blue swe:Count
definition =
http:sweet.jpl.nasa.gov2.0physRadiation.owlRadiance swe:description
Radiance measured on band3 swe:description
swe:Count swe:field
swe:DataRecord swe:elementType
swe:encoding swe:BinaryEncoding
byteOrder =
bigEndian byteEncoding
= base64
swe:member swe:Component
dataType =
http:www.opengis.netdefdataTypeOGC0unsignedByte ref
= rowpixelred
swe:member swe:member
swe:Component dataType
= http:www.opengis.netdefdataTypeOGC0unsignedByte
ref =
rowpixelgreen swe:member
swe:member swe:Component
dataType =
http:www.opengis.netdefdataTypeOGC0unsignedByte ref
= rowpixelblue
swe:member swe:BinaryEncoding
swe:encoding swe:values
FZEFZE564864HGZ6RG54Z684F86R7H4Z84FR8Z4685E468GTA4E8G4A6... swe:values
swe:DataArray swe:elementType
swe:DataArray
In this example the root component is the element type of the array in which the values are embedded i.e. the outer array. All paths used in the encoding section thus start with
this component name i.e. ‘row’ and then hierarchically list the names that lead to the scalar component whose data type is being defined.