Graph
Well-Known Binary

📦Well-Known Binary

NEW

Also known as: WKB

A compact binary format for representing geometric objects efficiently for storage and transfer.

DESCRIPTION

Well-Known Binary (WKB) encodes geometries as binary data defined by OGC’s Simple Features. It is efficient for storage, indexing, and network transfer in spatial databases. Extensions like EWKB add SRID and dimensionality. WKB complements WKT by trading human readability for performance. It is supported in PostGIS, GeoPackage, and many geospatial libraries.

ALTERNATIVE DEFINITIONS

Wikipedia

Well-known binary (WKB) is a binary format used to store geometric objects in a compact form.

Highlights compact storage of geometric objects.

Source

OGC

The Simple Feature Access standard defines the WKT and WKB encodings for geometry to enable interoperability across spatial systems.

Places WKB within the interoperability goal of Simple Features.

Source

PostGIS

PostGIS supports the OGC WKB and WKT representations of geometries as binary and text formats for input and output.

Emphasizes practical DBMS support for both encodings.

Source

OGC Simple Features EWKB PostGIS GeoPackage Spatial Index Binary Serialization Geometry Spatial SQL GDAL

COMPETING TERMS

GeoJSON Well-Known Text

KNOWLEDGE AREAS

Data Storage & Operations Data Integration & Interoperability Semantic & Knowledge Modeling Data Services Data Architecture

TARGET AUDIENCE

Data Engineer Software Developer Data Architect Solution Architect Data Scientist

EXTERNAL SOURCES

  • Wikipedia - Well-known text representation of geometry#Well-known binary
  • OGC - Standard defining WKB encoding
  • PostGIS - Function to output WKB
  • GeoPackage - Spec using WKB for geometries

TOP QUESTIONS

What is Well-Known Binary (WKB)?

WKB is a binary encoding for geometries defined by OGC, optimized for compact storage and efficient transfer.

Category: Definition

How does WKB differ from WKT?

WKB is binary and compact, ideal for storage and indexing; WKT is text and human-readable, useful for debugging and logs.

Category: Comparison

What systems support WKB?

Spatial databases like PostGIS and formats like GeoPackage, along with libraries in GDAL and common GIS SDKs, support WKB.

Category: Technology

What is EWKB?

Extended WKB adds fields like SRID and dimensionality (Z/M) beyond the OGC base specification. It’s common in PostGIS.

Category: Advanced

Is WKB endian-sensitive?

Yes, the encoding includes an endianness flag to interpret bytes correctly across platforms.

Category: Concepts

Can I convert WKB to WKT?

Yes, use database or library functions (e.g., ST_AsText/ST_AsBinary) to convert between encodings.

Category: How-to

Does WKB include CRS by default?

Standard WKB does not include CRS; EWKB or container formats like GeoPackage carry SRID information.

Category: Standards

Why use WKB over GeoJSON?

WKB is more compact and faster to parse for geometry operations, while GeoJSON is web-friendly and self-descriptive.

Category: Best Practices

What are common pitfalls with WKB?

Mismatched endianness or EWKB-specific fields causing interoperability issues. Validate and test across tools.

Category: Mistakes