Kmz Class

Reads and writes KMZ: a KML document, Kml, in a zip archive, with the files it references.

public static class Kmz

Remarks

The reader reads the doc.kml entry, or else the first .kml entry at the root of the archive, or else the first .kml entry of the archive, and ignores the other files, such as the icons and the images of the overlays. The writer writes the KML document in a doc.kml entry.

Methods

NameDescription
Read(Stream)Reads the placemarks of a KMZ archive.
Write(GeoFeatureCollection, Stream, KmlWriterOptions?)Writes features as a KMZ archive, with a doc.kml entry.

Read(Stream)

Kmz.cs

Reads the placemarks of a KMZ archive.

public static GeoFeatureCollection Read(Stream stream)

Parameters

stream Stream
The KMZ archive. It is left open. When it cannot seek, it is copied in memory.

Returns

GeoFeatureCollection The placemarks of the KML document of the archive.

Exceptions

FormatException
The stream is not a zip archive, the archive has no KML document, or the document is not well-formed XML or not KML.

Write(GeoFeatureCollection, Stream, KmlWriterOptions?)

Kmz.cs

Writes features as a KMZ archive, with a doc.kml entry.

public static void Write(GeoFeatureCollection features, Stream stream, KmlWriterOptions? options = null)

Parameters

features GeoFeatureCollection
The features.
stream Stream
The stream to write to. It is left open.
options KmlWriterOptions?
The options of the KML document, or null for the defaults.

Exceptions

ArgumentException
A position is not finite, or a text contains a character that XML cannot represent.