finds.dev

twpayne/go-geom

Package geom implements efficient geometry types for geospatial applications.

View on GitHub

★ 970GoBSD-2-Clauseupdated May 2026

// the take

go-geom is a pure-Go geometry library implementing OGC geometry types with support for 2D/3D coordinates and measures. It covers the full encoding/decoding stack — WKB, EWKB, GeoJSON, WKT, KML — and wires directly into database/sql for PostGIS workflows. For Go developers who need spatial types without pulling in a CGo dependency on GEOS, this is the practical choice.

The flat coordinate slice representation (documented in INTERNALS.md) is genuinely clever: all coordinates for a geometry live in a single contiguous []float64, which means cache-friendly iteration and zero per-point allocations. The sql.Scanner/driver.Value implementations for EWKB make PostGIS round-trips almost invisible — you just scan into a *geom.Point. The WKB fuzzer with a checked-in corpus shows the author actually thought about parser security, and the opt-in MaxGeometryElements guard for memory bomb inputs is the right API design: secure by default would break existing callers, so they made it explicit. The bigxy package using arbitrary-precision arithmetic for orientation tests is a nice touch for avoiding floating-point degeneracy bugs in edge cases.

WKT decoding is missing — the package ships a WKT encoder and a yacc grammar file but no public decoder, so you can write WKT but can't read it back, which is a real gap for interop with tools that emit WKT. The xy topology functions are a partial port from JTS and the coverage shows: no buffer, no union, no difference, no intersection — just the building blocks. If you need any actual spatial operations beyond centroid and convex hull, you're on your own or need to shell out to PostGIS. At ~970 stars it's used enough to be stable, but contributions are sparse and some open issues sit unanswered for years, so don't expect quick fixes if you hit a corner case.

We read the README, the directory tree and a key source file in July 2026. Nobody pays to be listed. How we judge →

// at a glance

Stars
970
Forks
113
Language
Go
License
BSD-2-Clause
Last commit
14 May 2026

// nearby

If go-geom isn't quite it.

All repos →