Introduction
Well-Known Binary (WKB) is the binary representation of vector geometries defined by
the Open Geospatial Consortium, the counterpart of
Well-Known Text. Saved to a file, it typically
carries the extension .wkb; FME also lists .bin for it.
Structure
Each geometry starts with a byte that gives the byte order (0 big-endian, 1 little-endian) and a four-byte type code: 1 point, 2 line string, 3 polygon, 4 to 7 the multi-part types and geometry collection, and 8 to 12 the curve types. Coordinates are eight-byte floating point numbers, line strings and rings carry counts, and a multi-part geometry holds complete WKB geometries. An empty point is written with not-a-number coordinates.
The standard form is two-dimensional. An extended form marks Z, M and a spatial
reference identifier with flag bits in the type code (0x80000000,
0x40000000 and 0x20000000), the identifier following in four
bytes. The ISO SQL/MM form instead adds 1000 for Z, 2000 for M or 3000 for both, and
has no identifier.
Not described
This page is a first outline. The format is not yet described in full here.
Known, not yet covered
- Reference: the byte layout of each geometry type and worked examples of the three variants.
- Viewer: the site has no viewer for this format.
Links
Software
- FME – data integration software with a WKB reader and writer
Developers
- GEOS – geometry library that reads and writes WKB (C++)
Reference
- GEOS: Well-Known Binary – the layout and its variants
- OGC 06-103r4, Simple feature access, part 1 – the standard, with the text and binary representations