|
|
|
@ -62,17 +62,17 @@ class kmz(object):
|
|
|
|
|
self.elements.append(kml.__dict__[key](value))
|
|
|
|
|
return self
|
|
|
|
|
|
|
|
|
|
def write(self, filename, debug=False):
|
|
|
|
|
def write(self, filename, version, debug=False):
|
|
|
|
|
date_time = datetime.datetime.now().timetuple()[:6]
|
|
|
|
|
zf = zipfile.ZipFile(filename, 'w')
|
|
|
|
|
document = kml.Document(open=1)
|
|
|
|
|
document = kml.Document()
|
|
|
|
|
document.add(*self.roots)
|
|
|
|
|
document.add(*self.elements)
|
|
|
|
|
string_io = StringIO()
|
|
|
|
|
if debug:
|
|
|
|
|
kml.kml('2.1', document).pretty_write(string_io)
|
|
|
|
|
kml.kml(version, document).pretty_write(string_io)
|
|
|
|
|
else:
|
|
|
|
|
kml.kml('2.1', document).write(string_io)
|
|
|
|
|
kml.kml(version, document).write(string_io)
|
|
|
|
|
zi = zipfile.ZipInfo('doc.kml')
|
|
|
|
|
zi.compress_type = zipfile.ZIP_DEFLATED
|
|
|
|
|
zi.date_time = date_time
|
|
|
|
|