Well-Known Binary Format

Teradata Vantage™ Geospatial Data Types

brand
Software
Teradata Vantage
prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
category
Programming Reference
featnum
B035-1181-162K

Purpose

Defines the format of geometry data when using a byte stream to construct new ST_Geometry instances or transfer ST_Geometry values to and from client applications.

Format

















Field … Specifies …
Byte Order an 8-bit value that indicates the binary representation of 32-bit unsigned integer values and 64-bit double precision values in the byte stream.

0 indicates big endian. The first octet is the most significant octet. For double precision values, the sign bit is in the first octet.

1 indicates little endian. The last octet is the most significant octet. For double precision values, the sign bit is in the last octet.

WKB Type a 32-bit unsigned integer value that indicates the geometry represented by the byte stream.

A value of:

  • 1 means a point (2D).
1001 means a point (3D).
  • 2 means a linestring (2D).
1002 means a linestring (3D).
  • 3 means polygon (2D).
1003 means a polygon (3D).
  • 4 means multipoint (2D).
1004 means a multipoint (3D).
  • 5 means a multilinestring (2D).
1005 means a multilinestring (3D).
  • 6 means a multipolygon (2D).
1006 means a multipolygon (3D).
  • 7 means a geometry collection (2D).
1007 means a geometry collection (3D).
  • 200 means geosequence.
X a 64-bit, double-precision value that represents the X coordinate value of an ST_Point value.
Y a 64-bit, double-precision value that represents the Y coordinate value of an ST_Point value.
Z a 64-bit, double-precision value that represents the Z coordinate value of an ST_Point value.
Num Points a 32-bit, unsigned integer that specifies the number of points (X, Y coordinate pairs) that are to follow.
X1 a 64-bit, double precision value that represents the X coordinate value of the first point of a geometry.
Y1 a 64-bit, double precision value that represents the Y coordinate value of the first point of a geometry.
Z1 a 64-bit, double precision value that represents the Z coordinate value of the first point of a geometry.
X n a 64-bit, double precision value that represents the X coordinate value of the nth point of a geometry, where n is defined by the Num Points field that precedes the series of points.

Note that if the preceding Num Points field specifies a value of 1, the series of points is defined by the X1, Y1, and Z1 fields only and does not require any more X or Y coordinates.

Y n a 64-bit, double precision value that represents the Y coordinate value of the nth point of a geometry, where n is defined by the Num Points field that precedes the series of points.

Note that if the preceding Num Points field specifies a value of 1, the series of points is defined by the X1, Y1, and Z1 fields only and does not require any more X or Y coordinates.

Z n a 64-bit, double precision value that represents the Z coordinate value of the nth point of a geometry, where n is defined by the Num Points field that precedes the series of points.

Note that if the preceding Num Points field specifies a value of 1, the series of points is defined by the X1, Y1, and Z1 fields only and does not require any more X or Y coordinates.

Num Linear Rings a 32-bit, unsigned integer that specifies the number of linear rings (closed and simple linestrings) that are to follow.
Num Linestrings a 32-bit, unsigned integer that specifies the number of linestrings that are to follow.
Num Polygons a 32-bit, unsigned integer that specifies the number of polygons that are to follow.
Num Elements a 32-bit, unsigned integer that specifies the number of geometries that are to follow.
WKB Geometry the fields that represent the geometry specified by the value of the preceding WKB Type field.

For example, suppose the value of the WKB Type field in the first geometry element of a Geometry collection is 1, indicating that the first geometry is a point. The fields that follow must be X and Y.

Init TS the initial timestamp associated with the first point of a geosequence, where the timestamp consists of the following fields:
  • Seconds is a 32-bit unsigned integer value where the first two digits represent the seconds value of the timestamp and the next six digits represent the fractional seconds of the timestamp. The valid range for the first two digits is 0 to 61.
  • Year is a 16-bit unsigned integer value that represents the year value of the timestamp. The valid range is from 1 to 9999.
  • Month is an 8-bit unsigned integer value that represents the month value of the timestamp. The valid range is from 1 to 12.
  • Day is an 8-bit unsigned integer value that represents the day value of the timestamp. The valid range is from 1 to 31, constrained by Gregorian calendar definitions.
  • Hour is an 8-bit unsigned integer value that represents the hour value of the timestamp. The valid range is from 0 to 23.
  • Minute is an 8-bit unsigned integer value that represents the minute value of the timestamp. The valid range is from 0 to 59.
Delta1 a 32-bit integer value that specifies the difference, in milliseconds, between the initial timestamp and the timestamp of the second point in the geosequence.
Delta n-1 a 32-bit integer value that specifies the difference, in milliseconds, between the penultimate timestamp and the timestamp of the last point in the geosequence.
LinkID1 a 64-bit NUMERIC(18,0) value that specifies the link ID of the first point of the geosequence. Link IDs are reserved for a future release.
LinkID n a 64-bit NUMERIC(18,0) value that specifies the link ID of the nth point of the geosequence, where n is defined by the Num Points field. Link IDs are reserved for a future release.
Num User Fields a 32-bit unsigned integer value that specifies the number of optional user fields of data for each point in the geosequence.
UField1 P1 a 64-bit double precision value that represents the first user field for the first point in the geosequence.

Note that if the value of the Num User Fields field is zero, no user fields appear in the byte stream.

UField1 P n a 64-bit double precision value that represents the first user field for the nth point in the geosequence, where n is defined by the Num Points field.

Note that if the value of the Num User Fields field is zero, no user fields appear in the byte stream.

UField j P1 a 64-bit double precision value that represents the jth user field for the first point in the geosequence, where j is defined by the Num User Fields field.

Note that if the value of the Num User Fields field is zero, no user fields appear in the byte stream.

UField j P n a 64-bit double precision value that represents the jth user field for the nth point in the geosequence, where j is defined by the Num User Fields field and n is defined by the Num Points field.

Note that if the value of the Num User Fields field is zero, no user fields appear in the byte stream.