finds.dev← search

// the find

twpayne/go-geom

★ 970 · Go · BSD-2-Clause · updated May 2026

Package geom implements efficient geometry types for geospatial applications.

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.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →