geobabel
Package geobabel
converts geometry types between popular geometry libraries.
Supported geometry types are:
-
Well Known Binary (WKB)
geobabel
exists because no single geometry library is perfect. For example:
-
github.com/paulmach/orb
is a pure Go library with friendly API, excellent support for OpenStreetMap data and MapBox Vector Tiles, but only supports 2D geometries, and has a heavy focus on the commonly-used EPSG:4326 and EPSG:3857 projections. -
github.com/twpayne/go-geom
is extremely high performance pure Go library that supports multi-dimensional geometries, multiple encodings, and is projection-agnostic, at the expense of a more complex API and a very limited set of geometric operations. -
github.com/twpayne/go-geos
provides an idiomatic Go API to the huge set of battle-tested geometric operations in the industry-standard GEOS library, at the expense of cgo overhead, C-style memory management, and a focus on 2D geometries.
With geobabel
you can combine the best aspects of each library. For example,
you can use a pure Go library like go-geom
or orb
to represent your
geometries and use a geometric operation that is only available in go-geos
.
Supported conversions
To geom.T |
To *geos.Geom |
To orb.Geometry |
To WKB | |
---|---|---|---|---|
From geom.T |
n/a | no | yes | yes |
From *geos.Geom |
no | n/a | yes | yes |
From orb.Geometry |
yes | yes | n/a | yes |
From WKB | yes | yes | yes | n/a |
Note that WKB does not support LinearRings as a top-level geometry type.
License
MIT