Documentation
¶
Overview ¶
A KML library with Google KML extensions
Index ¶
- Constants
- type AtomAuthor
- type Boundary
- type Color
- type Data
- type Document
- type Element
- type ExtendedData
- type Folder
- type GxSimpleArrayField
- type IconStyle
- type Kml
- type LineString
- type LineStyle
- type LinearRing
- type MultiGeometry
- type MultiGeometryPlacemark
- type Path
- type Placemark
- type Point
- type Polygon
- type PolygonPlacemark
- type Schema
- type Style
Constants ¶
const (
DefaultNamespace = "http://www.opengis.net/kml/2.2"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AtomAuthor ¶
type AtomAuthor struct {
XMLName xml.Name `xml:"http://www.w3.org/2005/Atom author"`
Name string `xml:"name,omitempty"`
}
* Container type Atom Author
func NewAtomAuthor ¶
func NewAtomAuthor(name string) AtomAuthor
NewAtomAuthor() creates a new atom authro
type Boundary ¶
type Boundary struct {
LinearRing LinearRing `xml:"LinearRing"`
}
Boundary represents a boundary in a Polygon
type Color ¶
type Color struct {
// contains filtered or unexported fields
}
func NewColorHSLA ¶
func NewColorRGBA ¶
type Data ¶
type Data struct {
XMLName xml.Name `xml:"Data"`
Name string `xml:"name,attr"`
Value string `xml:"value"`
}
Data that goes in ExtendedData
type Document ¶
type Document struct {
XMLName xml.Name `xml:"Document"`
Id string `xml:"id,attr,omitempty"`
Name string `xml:"name,omitempty"`
Visibility int `xml:"visibility,omitempty"`
Open int `xml:"open,omitempty"`
AtomAuthor AtomAuthor `xml:"http://www.w3.org/2005/Atom author,omitempty"`
Address string `xml:"address,omitempty"`
PhoneNumber string `xml:"phoneNumber,omitempty"`
Description string `xml:"description,omitempty"`
Schema []Schema `xml:"Schema"`
DocStyle []Style `xml:"Style"`
Placemarks []Placemark `xml:"Placemark"`
Folders []Folder `xml:"Folder"`
Elements []interface{}
}
* Container type Document
func ConvertGeoJSONToKMLDocument ¶
ConvertGeoJSONToKMLDocument converts GeoJSON data to a KML Document
func (*Document) AddElement ¶
AddElement() adds a path to the document
func (*Document) AddPlacemark ¶
AddPlacemark() adds a placemark to the document
type ExtendedData ¶
ExtendedData for placemarks
func NewExtendedData ¶
func NewExtendedData() ExtendedData
NewExtendedData() creates new extended data
func (*ExtendedData) AddData ¶
func (e *ExtendedData) AddData(name, value string)
AddData() adds data of {name, value} to the ExtendedData structure
type Folder ¶
type Folder struct {
XMLName xml.Name `xml:"Folder"`
Id string `xml:"id,attr,omitempty"`
Name string `xml:"name,omitempty"`
Visibility int `xml:"visibility,omitempty"`
Open int `xml:"open,omitempty"`
Address string `xml:"address,omitempty"`
PhoneNumber string `xml:"phoneNumber,omitempty"`
Description string `xml:"description,omitempty"`
Placemarks []Placemark `xml:"Placemark"`
Folders []Folder `xml:"Folder"`
Elements []interface{}
}
* Container type Folder
func (*Folder) AddElement ¶
func (f *Folder) AddElement(e interface{})
AddElement() adds a path to the document
func (*Folder) AddPlacemark ¶
AddPlacemark() adds a placemark to the folder
func (*Folder) SetVisibility ¶
SetVisibility() sets the visibility of the folder
type GxSimpleArrayField ¶
type IconStyle ¶
type IconStyle struct {
XMLName xml.Name `xml:"IconStyle"`
Scale string `xml:"scale,omitempty"`
Heading string `xml:"heading,omitempty"`
Href string `xml:"Icon>href,omitempty"`
}
IconStyle
func NewIconStyle ¶
type Kml ¶
type Kml struct {
XMLName xml.Name `xml:"kml"`
Namespace string `xml:"xmlns,attr"`
Document Document `xml:"Document"`
Placemarks []Placemark `xml:"Placemark"`
Folders []Folder `xml:"Folder"`
Elements []Element
}
Kml is the base Kml document
func JsonUnmarshal ¶
JSON Unmarshal() returns a kml struct unmarshalled from the provided byte array
func (*Kml) AddDocument ¶
AddDocument() adds a document to the kml structure
func (*Kml) AddElement ¶
AddElement() adds a path to the document
func (*Kml) AddPlacemark ¶
AddPlacemark() adds a placemark to the document
func (*Kml) JsonMarshal ¶
JSON Marshal() returns a properly indented XML structure
type LineString ¶
type LineString struct {
XMLName xml.Name `xml:"LineString"`
Coordinates string `xml:"coordinates"`
}
LineString represents a KML LineString geometry
type LineStyle ¶
type LineStyle struct {
XMLName xml.Name `xml:"LineStyle"`
Color string `xml:"color,omitempty"`
Width string `xml:"width,omitempty"`
}
LineStyle
func NewLineStyle ¶
type LinearRing ¶
type LinearRing struct {
Coordinates string `xml:"coordinates"`
}
LinearRing represents a LinearRing in a boundary
type MultiGeometry ¶
type MultiGeometry struct {
XMLName xml.Name `xml:"MultiGeometry"`
Geometries []interface{} `xml:",any"`
}
MultiGeometry represents a KML MultiGeometry
type MultiGeometryPlacemark ¶
type MultiGeometryPlacemark struct {
XMLName xml.Name `xml:"Placemark"`
Id string `xml:"id,attr,omitempty"`
Name string `xml:"name,omitempty"`
Description string `xml:"description,omitempty"`
StyleUrl string `xml:"styleUrl,omitempty"`
MultiGeometry MultiGeometry `xml:"MultiGeometry"`
Extended ExtendedData `xml:"ExtendedData"`
}
MultiGeometryPlacemark is a Placemark with MultiGeometry
func (*MultiGeometryPlacemark) Marshal ¶
func (p *MultiGeometryPlacemark) Marshal() ([]byte, error)
Marshal for MultiGeometryPlacemark
type Path ¶
type Path struct {
XMLName xml.Name `xml:"Placemark"`
Id string `xml:"id,attr,omitempty"`
Name string `xml:"name,omitempty"`
Description string `xml:"description,omitempty"`
StyleUrl string `xml:"styleUrl,omitempty"`
Coordinates string `xml:"LineString>coordinates"`
Extended ExtendedData `xml:"ExtendedData"`
Style Style `xml:",omitempty"`
TimeStamp string `xml:"TimeStamp,omitempty"`
}
* Path
func (*Path) AddCoordinates ¶
AddCoordinates takes latitude, longitude, and altitude and adds the Coordinate value to the path
func (*Path) AddExtendedData ¶
func (p *Path) AddExtendedData(e ExtendedData)
AddExtendedData() adds an ExtendedData structure to the Path
func (*Path) SetCoordinates ¶
SetCoordinates takes latitude, longitude, and altitude and sets the Coordinates value of the Path.
type Placemark ¶
type Placemark struct {
XMLName xml.Name `xml:"Placemark"`
Id string `xml:"id,attr,omitempty"`
Name string `xml:"name,omitempty"`
Description string `xml:"description,omitempty"`
StyleUrl string `xml:"styleUrl,omitempty"`
Coordinates string `xml:"Point>coordinates"`
Extended ExtendedData `xml:"ExtendedData"`
TimeStamp string `xml:"TimeStamp,omitempty"`
}
* Placemark
func NewPlacemark ¶
NewPlacemark() creates a new placemark. All parameters are strings.
func (*Placemark) AddExtendedData ¶
func (p *Placemark) AddExtendedData(e ExtendedData)
AddExtendedData() adds an ExtendedData structure to the Placemark
func (*Placemark) SetCoordinates ¶
SetCoordinates takes latitude, longitude, and altitude and sets the Coordinates value of the Placemark.
type Polygon ¶
type Polygon struct {
XMLName xml.Name `xml:"Polygon"`
OuterBoundaryIs Boundary `xml:"outerBoundaryIs"`
InnerBoundaryIs []Boundary `xml:"innerBoundaryIs"`
}
Polygon represents a KML Polygon geometry
type PolygonPlacemark ¶
type PolygonPlacemark struct {
XMLName xml.Name `xml:"Placemark"`
Id string `xml:"id,attr,omitempty"`
Name string `xml:"name,omitempty"`
Description string `xml:"description,omitempty"`
StyleUrl string `xml:"styleUrl,omitempty"`
Polygon Polygon `xml:"Polygon"`
Extended ExtendedData `xml:"ExtendedData"`
}
PolygonPlacemark is a Placemark with Polygon
func (*PolygonPlacemark) Marshal ¶
func (p *PolygonPlacemark) Marshal() ([]byte, error)
Marshal for PolygonPlacemark