Is there a way to change the root KML of a KMZ object after the KMZ has been created?
At the moment I am doing this:
- Create main KML
- Create KMZ based on main KML
- Add orther files to the KMZ
- Save KMZ to disk file
I would like to modify the main KML just before I save the KMZ to disk. Is this possible?
Jun 6, 2013 at 9:05 PM
It is but it's not a simple as it should be and it might not work if the KMZ archive contains more than one KML file (I'm not sure how the
UpdateEntry works in the zip library - as long as it keeps the order of the table of contents the same then it will work fine with multiple KML files).
What you can do is replace the root KML file. You can call the
UpdateFile method with the name of the root KML file, which will be
KmzFile.DefaultKmlFilename), but you'll have to save the KML to a byte array first (either save the
KmlFile to a
MemoryStream or use the
Serializer class, as used by the
Hope that helps but let me know if you get stuck and I'll try to post some code.