To get things straight, there are basically two spatial data binary (BLOB) representations supported by Spatialite: WKB and internal. And in the meantime, there are several spatial data text representations also supported, including WKT, GML, KML and GeoJSON and so on.
WKB (Well-Known Binary) and WKT (Well-Known Text) (see footnote 3) are OGC standards designed to be exchangeable across different platforms. The internal representation of any geometry within Spatialite is specific to Spatialite, therefore it is not intended to support data exchange between different platforms but for efficiency and robustness (See footnote 1).
Whatever the representations they are, they are all representing geometries (see footnote 2) in space, which are detailed here:
One thing worth noticing in the model is Polygon is simply a set of __LineString__s, and one of the __LineString__s is the exterior ring (one and only!).
To know more concrete implementation details of the representations for WKT, WKB and Spatialite internal blob, see these links:
Another confusion when using Spatialite for me was seeing some coordinate encodings like this: XY, XYM, XYZ and XYZM. This is some standard defined by OGC and they are actually dimensional models:
- XY is 2D - two cartesian coordinates for each point / vertex.
- XYM is also 2D, but plus a measure value M for each point / vertex.
- XYZ is 3D, three cartesian coordinates for each point / vertex.
- XYZM is also 3D with a measure value M for each point / vertex.
M is a relative measure that defines the scale of the geometry (like the scales in a map).
1 Blob is good for saving space for storage, and faster to process by predefined specific operations on bytes
2 Points, Lines and Polygons
3 WKT is in ASCII texts