Internal BLOB-TinyPoint format [since version 5.0]

back to BLOB-Geometry

TinyPoint is an alternative BLOB format specifically optimized to store Point-Geometries [POINT, POINT Z, POINT M or POINT ZM] consuming a very low storage amount.

Important notice: developers intending to develop their own codecs supporting the BLOB-TinyPoint encoding could probably find useful using the tinypoint-sample.sqlite DB as a practical implementation reference.

BLOB-TinyPoint format specification

Byte Offset Content Notes
0 START [hex 00] a TinyPoint encoded BLOB value must always start with a 0x00 byte
1 ENDIAN
[hex 80 or hex 81]
if this TinyPoint is BIG_ENDIAN ordered must contain a 0x80 byte value
otherwise, if this TinyPoint is LITTLE_ENDIAN ordered must contain a 0x81 byte value
Any other value [neither 0x80 nor 0x81], means that this BLOB cannot be a valid TinyPoint
2 - 5 SRID a 32-bits integer value [little- big-endian ordered, accordingly with the precedent one]
corresponding to the SRID for this TinyPoint
6 TINYPOINT TYPE
  • 0x01 = TINYPOINT_XY
  • 0x02 = TINYPOINT XYZ
  • 0x03 = TINYPOINT_XYM
  • 0x04 = TINYPOINT_XYZM
All following bytes are interpreted accordingly to this one Type declaration; any other value in this position causes the current one to be considered as an invalid TinyPoint.
7 - ... Point Type specific length and content depends on Point Type [POINT, POINT Z, POINT M or POINT ZM]
LAST END [hex FE] a TinyPoint encoded BLOB value must always end with a 0xFE byte

The preceding one is the general format that SpatiaLite uses for internal representations of any BLOB encoded TinyPoint.
Specific formats for the various classes of POINT-GEOMETRY are as follows:
SFS GEOMETRY Class TinyPoint Type
Format
Byte Offset Content Notes
POINT TINYPOINT_XY
0 - 7 X coordinate a double value corresponding to the X coordinate for this POINT
8 - 15 Y coordinate a double value corresponding to the Y coordinate for this POINT

POINT Z TINYPOINT_XYZ
0 - 7 X coordinate a double value corresponding to the X coordinate for this POINT Z
8 - 15 Y coordinate a double value corresponding to the Y coordinate for this POINT Z
16 - 23 Z coordinate a double value corresponding to the Z coordinate for this POINT Z

POINT M TINYPOINT_XYM
0 - 7 X coordinate a double value corresponding to the X coordinate for this POINT M
8 - 15 Y coordinate a double value corresponding to the Y coordinate for this POINT M
16 - 23 M coordinate a double value corresponding to the M coordinate for this POINT M

POINT ZM TINYPOINT_XYZM
0 - 7 X coordinate a double value corresponding to the X coordinate for this POINT ZM
8 - 15 Y coordinate a double value corresponding to the Y coordinate for this POINT ZM
16 - 23 Z coordinate a double value corresponding to the Z coordinate for this POINT ZM
24 - 31 M coordinate a double value corresponding to the M coordinate for this POINT ZM


back to BLOB-Geometry