GeoJSON to WKB Converter
The shortest path from a web-mapping dataset to a row in a spatial database — convert once, then bulk-load via psql or your ORM.
Common issues converting GeoJSON to WKB
- WKB has no SRID by default. PostGIS users typically prefer EWKB (the geometry column type), which prefixes the SRID — many spatial DBs accept either. Our output is OGC WKB; reproject to your target CRS before conversion.
- Multi-geometry GeoJSON features (MultiPolygon, GeometryCollection) become single WKB records — they don't get split. Order is preserved.
- WKB encodes the geometry only, not properties. Feature attributes are dropped — store them in a separate column or use a format like FlatGeobuf or GeoParquet that carries both.
- Binary output. Use a hex viewer or pipe through `ST_AsText(ST_GeomFromWKB(...))` in PostGIS to inspect; don't try to open in a text editor.
Frequently asked questions
Is the output EWKB or plain OGC WKB?
Plain OGC WKB. If you need EWKB (PostGIS's internal form with an SRID flag), call ST_SetSRID(ST_GeomFromWKB($1), 4326) at INSERT time.
What endianness does the output use?
Little-endian, which is the de-facto standard among GIS libraries. The first byte of each geometry record is 0x01.
Can I bulk-load WKB into PostGIS?
Yes. Use `COPY table FROM stdin BYTEA` with hex-encoded WKB, or pipe through `ST_GeomFromWKB` in a prepared statement. The output here is raw binary; encode-to-hex if your tooling expects that.
Does the converter preserve Z (elevation)?
Yes. 3D GeoJSON coordinates produce WKB records with the OGC ISO Z-modifier (type code + 1000). Z=0 is written for any feature where the source coordinate has only X/Y.