Home

Awesome

go-kml

PkgGoDev

Package kml provides convenience methods for creating and writing KML documents.

Key Features

Example

func ExampleKML() {
    k := kml.KML(
        kml.Placemark(
            kml.Name("Simple placemark"),
            kml.Description("Attached to the ground. Intelligently places itself at the height of the underlying terrain."),
            kml.Point(
                kml.Coordinates(kml.Coordinate{Lon: -122.0822035425683, Lat: 37.42228990140251}),
            ),
        ),
    )
    if err := k.WriteIndent(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>
    <name>Simple placemark</name>
    <description>Attached to the ground. Intelligently places itself at the height of the underlying terrain.</description>
    <Point>
      <coordinates>-122.0822035425683,37.42228990140251</coordinates>
    </Point>
  </Placemark>
</kml>

There are more examples in the documentation corresponding to the examples in the KML tutorial.

Subpackages

License

MIT