Skip to content

Commit

Permalink
requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
apurvabanka committed Nov 13, 2024
1 parent dbca8ac commit 6b2cf51
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions fastkml/kml.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"""

import logging
import os
from pathlib import Path
from typing import IO
from typing import Any
Expand Down Expand Up @@ -257,7 +256,7 @@ def write(
Write KML to a file
Args:
----
file_name: The file name where to save the file.
file_path: The file name where to save the file.
Can be any string value
prettyprint : bool, default=True
Whether to pretty print the XML.
Expand Down Expand Up @@ -288,9 +287,9 @@ def write(

if file_path.suffix == ".kmz":
with zipfile.ZipFile(file_path, 'w', zipfile.ZIP_DEFLATED) as kmz:
kmz.write(file_path, arcname=os.path.basename(file_path))
kmz.writestr('doc.kml', tree)
else:
with open(file_path, "w") as file:
with open(file_path, "w", encoding="UTF-8") as file:
file.write(tree)


Expand Down
4 changes: 2 additions & 2 deletions tests/kml_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def test_write_kml_file(self) -> None:
)

file_path = KMLFILEDIR / "output.kml"
kml.KML.write(doc, file_path=file_path, prettyprint=True, xml_declaration=True)
doc.write(file_path=file_path, prettyprint=True, xml_declaration=True)

assert file_path.is_file(), "KML file was not created."

Expand All @@ -236,7 +236,7 @@ def test_write_kmz_file(self) -> None:

file_path = KMLFILEDIR / "output.kmz"

kml.KML.write(doc, file_path=file_path, prettyprint=True, xml_declaration=True)
doc.write(file_path=file_path, prettyprint=True, xml_declaration=True)

assert file_path.is_file(), "KMZ file was not created."

Expand Down
Binary file modified tests/ogc_conformance/data/kml/output.kmz
Binary file not shown.

0 comments on commit 6b2cf51

Please sign in to comment.