Here's an example:

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

import (
"log"
"os"

enckml "github.com/twpayne/go-geom/encoding/kml"
"github.com/twpayne/go-geom/encoding/wkbhex"
"github.com/twpayne/go-kml"
)

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<----


On 27 March 2017 at 19:15, Constantine Vassilev <thst...@gmail.com> wrote:

> How to use go-geom to convert WKBHEX to KML?
>
> Are there a simple example?
>
> On Sunday, November 13, 2016 at 10:33:27 AM UTC-8, Tom Payne wrote:
>>
>> 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
>> <https://github.com/twpayne/go-geom/blob/master/INTERNALS.md>), with
>> import and export from multiple formats
>> <https://github.com/twpayne/go-geom/blob/master/README.md> (e.g.
>> GeoJSON, WKB, KML) and many 2D geometry functions
>> <https://godoc.org/github.com/twpayne/go-geom/xy>. Really easy PostGIS
>> integration with database/sql
>> <https://github.com/twpayne/go-geom/blob/master/encoding/wkb/scan_test.go>
>> .
>>
>> <http://goog_579174976>
>> https://github.com/twpayne/go-kml : generate KML files quickly and
>> flexibly.
>>
>> <http://goog_579174978>
>> https://github.com/twpayne/go-gpx : read and write GPX files.
>>
>> <http://goog_579174980>
>> 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
>> <https://github.com/twpayne/go-geom/blob/master/INTERNALS.md> 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!
>>
> --
> 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+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to