[ANN] Go geospatial libraries: geometries, GeoJSON, WKB, KML, PostGIS, GPX, polyline

1,018 views
Skip to first unread message

Tom Payne

unread,
Nov 13, 2016, 1:33:27 PM11/13/16
to golang-nuts
A quick announce of a few libraries for geospatial applications that are now mature and battle-tested:

https://github.com/twpayne/go-geom : efficient geometry library, using a high-performance cache-friendly data representation (more info), with import and export from multiple formats (e.g. GeoJSON, WKB, KML) and many 2D geometry functions. Really easy PostGIS integration with database/sql.

https://github.com/twpayne/go-kml : generate KML files quickly and flexibly.

https://github.com/twpayne/go-gpx : read and write GPX files.

https://github.com/twpayne/go-polyline : encode and decode data to/from Google Maps Polyline format.

I think that go-geom's internal data representation is a nice example of high performance Go code and a reasonable attempt at practical code while the language does not support generics.

All feedback welcome!

Daniel Whitenack

unread,
Nov 14, 2016, 5:25:19 PM11/14/16
to golang-nuts
Thanks Tom! I think it would be great to add a few of these here:


where you think it is appropriate.  Would you consider submitting a PR with some additions?

Daniel

Tom Payne

unread,
Nov 15, 2016, 12:49:21 PM11/15/16
to golang-nuts
Done. I've also added a link to github.com/golang/geo, a library for geometry on the sphere.

Constantine Vassilev

unread,
Mar 27, 2017, 1:15:45 PM3/27/17
to golang-nuts
How to use go-geom to convert WKBHEX to KML?

Are there a simple example?

Tom Payne

unread,
Mar 27, 2017, 2:14:48 PM3/27/17
to Constantine Vassilev, golang-nuts
Here's an example:

----8<----
package main

import (
"log"
"os"

)

func main() {
g, err := wkbhex.Decode("000000000140000000000000004010000000000000")
if err != nil {
log.Fatal(err)
}
e, err := enckml.Encode(g)
if err != nil {
log.Fatal(err)
}
if err := kml.KML(kml.Placemark(e)).Write(os.Stdout); err != nil {
log.Fatal(err)
}
// Output:
// <?xml version="1.0" encoding="UTF-8"?>
// <kml xmlns="http://www.opengis.net/kml/2.2"><Placemark><Point><coordinates>2,4</coordinates></Point></Placemark></kml>
}

----8<----


--
You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/GdssAIB6000/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Constantine Vassilev

unread,
Mar 30, 2017, 11:41:04 AM3/30/17
to golang-nuts, ths...@gmail.com
Hi Tom,

It worked perfectly. Thank you!

--Constantine
To unsubscribe from this group and all its topics, send an email to golang-nuts...@googlegroups.com.

Michael Jones

unread,
Mar 30, 2017, 2:31:19 PM3/30/17
to Constantine Vassilev, golang-nuts
Hard to do better than KML. :-)

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Michael T. Jones
michae...@gmail.com
Reply all
Reply to author
Forward
0 new messages