Spaten is a modern geo data format that aims to resolve issues that arise from using legacy serialization methods and simplify workflows.
The goals of Spaten are:
Spaten is aimed to be flexible and future-proof. It incorporates versioning and feature flags, so the underlying structure can be replaced in the future without breaking backwards compatibility. Note that this does not ensure forward compatibility, because older decoders might not be able to unmarshal newer messages. Nonetheless encoders and decoders should be able to determine compatibility easily and changes to the base structure are going to be taken conservatively.
The block structure enables parallelized serialization/deserialization. This removes the necessity to have meta files, as e.g. present in Shapefiles.
Please note that unless stated otherwise encoding is assumed to be little endian.
The file header contains a cookie (53 50 41 54
) which makes it easy to determine that this is a Spaten file even without proper file extension (first 4 bytes). The next 4 bytes defined the file format version, it is currently 0
and is not planned to be changed any time soon.
After the header block, there can be an arbitrary number of blocks. There should be at least one block.
The block starts with a 4 byte long body length field, which describes the byte length of the body.
The next 2 bytes are reserved for flags. No flag values are specified yet.
The following byte is reserved for compression information. Currently there are no compression methods specified.
The next sequence byte is a field for defining the body serialization. Those are the allowed values:
Integer Value | Message Type |
---|---|
0 | v0, based on Protocol Buffers |
The body is a blob, the internal encoding is depending on the Message Type
value.
v0 is based on the established Protocol Buffers serialization format. Protocol Buffer messages have definition files, which describe which fields can/must be included in a serialized message and which types they have: Proto Definition File.
The root element is Body
, which can contain block wide meta data in the Tag
structure (e.g. reference system). Furthermore it contains an array of Feature
.
Every Feature
has a geometry type enumeration (Point, Line, Polygon). The geom
field is a byte blob, which contains a geometry in the specified serialization format. The only currently supported geometry serialization is WKB, as specified by the OGC.
Note that ValueType
inside a Tag
describes how the value
is encoded. 0
is string (encoded as UTF-8), 1
is an integer (little endian, 8 Byte), 2
is a double.
The file extension of Spaten files should be .spaten
.
The contents of this specification are licensed under Creative Commons Attribution-ShareAlike 4.0 International license. However code that results from implementing the spec is not restricted.