PostGIS and Go (Golang) success

Tom Payne twpayne at gmail.com
Wed Feb 7 09:47:12 PST 2024


Hi,

This message is more as a reference for current and future PostGIS/Golang
users.

I've been using PostGIS with Go very successfully. The combination of
PostGIS's awesome power and Go's "better Python" (static typing, built-in
concurrency, compiled) is a fantastic for writing geo pipelines with custom
processing steps.

I've written a number of open source libraries that may be of help to
others:

https://github.com/twpayne/go-geos - official Go bindings for GEOS
https://github.com/twpayne/go-proj - official Go bindings for PROJ
https://github.com/twpayne/pgx-geos - PostGIS and GEOS support for
github.com/jackc/pgx

This particular combo works very well with https://sqlc.dev (which supports
several languages, not just Go).

My workflow for a custom processing step is:
1. Write a SELECT query to retrieve input data.
2. Write an INSERT (or COPY FROM) query to persist output data.
3. sqlc generates type-safe bindings to these queries directly from the
queries.
4. Call the SELECT function which returns PostGIS geometries as GEOS
objects.
5. Manipulate the GEOS objects using the full power of GEOS and Go. Go is
already fast, and for bulk operations, Go's concurrency allows me to use
all my CPU cores.
6. Call the INSERT function to persist the GEOS objects in PostGIS.

Regards,
Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20240207/496943ca/attachment.htm>


More information about the postgis-users mailing list