Documentation
¶
Overview ¶
Package kmlio reads and writes KML (Keyhole Markup Language, OGC 12-007r2) as gobi Frames.
KML always stores coordinates in WGS 84 (lon, lat[, alt]) per the OGC spec, so output frames have their geometry column tagged with EPSG:4326.
The reader flattens every <Placemark> in the document. Each placemark contributes one row with columns:
- name (string, from <name>)
- description (string, from <description>)
- geometry (WKB Binary, tagged EPSG:4326)
- <ext-key> one string column per distinct <ExtendedData><Data> name= attribute seen in the document
The writer emits one <Placemark> per row. String / numeric columns other than "name", "description", and the geometry column become <ExtendedData> entries.
Not implemented (out of scope for a small first cut):
- <Style>, <StyleMap>, <NetworkLink>, <Document> nesting semantics
- Time / TimeSpan primitives
- KMZ (zipped KML) — deliberately deferred; use gzip/zstd via csvio as a stopgap or unzip first
- Non-primitive KML geometries (Model, gx:Track)
Index ¶
- Variables
- func Read(r io.Reader, opts *ReadOptions) (*gobi.Frame, error)
- func ReadFile(path string, opts *ReadOptions) (*gobi.Frame, error)
- func Write(f *gobi.Frame, w io.Writer, opts *WriteOptions) error
- func WriteFile(f *gobi.Frame, path string, opts *WriteOptions) error
- type ReadOptions
- type WriteOptions
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidKML = errors.New("kmlio: invalid input")
ErrInvalidKML is returned when the input isn't a well-formed KML or uses a construct this package doesn't support.
Functions ¶
func ReadFile ¶
func ReadFile(path string, opts *ReadOptions) (*gobi.Frame, error)
ReadFile parses path and returns a Frame. See package doc for the column shape. Pass nil opts for defaults.
Types ¶
type ReadOptions ¶
type ReadOptions struct{}
ReadOptions reserves a slot for future read-time configuration (e.g., skip-Style, geometry-column-name override, folder-name prefixing). Currently empty — pass nil.
The struct exists so future options can be added without breaking the ReadFile / Read signatures. Matches the naming pattern used by parquetio, csvio, gpkgio, geojsonio, and pgio.
type WriteOptions ¶
type WriteOptions struct{}
WriteOptions reserves a slot for future write-time configuration (e.g., document-name / description, KMZ compression, style injection). Currently empty — pass nil.