kml: add KML generation functions