kmz

package module
v0.0.0-...-1652813 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2016 License: MIT Imports: 3 Imported by: 1

README

go-kmz

Build Status

Package kmz provides convenience methods for creating and writing KMZ files.

See https://godoc.org/github.com/twpayne/go-kmz.

Example:

func ExampleNewKMZ() {
	kmz := NewKMZ(
		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}),
			),
		),
	)
	w := &bytes.Buffer{}
	if err := kmz.WriteIndent(w, "", "\t"); err != nil {
		log.Fatal(err)
	}
}

License

Documentation

Overview

Package kmz provides convenience methods for creating and writing KMZ files.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KMZ

type KMZ struct {
	// contains filtered or unexported fields
}

A KMZ represents the contents of a KMZ file.

func NewKMZ

func NewKMZ(roots ...kml.Element) *KMZ

NewKMZ returns a new KMZ with the specified roots.

Example
kmz := NewKMZ(
	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}),
		),
	),
)
w := &bytes.Buffer{}
if err := kmz.WriteIndent(w, "", "\t"); err != nil {
	log.Fatal(err)
}
Output:

func (*KMZ) AddFile

func (kmz *KMZ) AddFile(filename string, contents []byte) *KMZ

AddFile adds a file named filename with contents to contents.

func (*KMZ) AddRoot

func (kmz *KMZ) AddRoot(root kml.Element) *KMZ

AddRoot adds root as a root.

func (*KMZ) Write

func (kmz *KMZ) Write(w io.Writer) error

Write writes the KMZ file to w.

func (*KMZ) WriteIndent

func (kmz *KMZ) WriteIndent(w io.Writer, prefix, indent string) error

WriteIndent writes the KMZ file to w with indentation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL