I am trying to compress a KML file using gzip on a Linux system

gzip -cvf somefile.kml > somefile.kmz

When I go to try and verify the new KMZ file in Google Earth, I receive the following error:

Open of file "somefile.kmz" failed: Parse error at line 1, column 0: not well-formed (invalid token)

What happened?

  • 1
    gzip and zip outputs are not equivalent formats. KMZ requires zip
    – Vince
    Mar 4, 2019 at 16:27

1 Answer 1


Shout-out to @Vince for the help:

Terminal Code

zip -9 somefile.zip somefile.kml
mv -f somefile.zip somefile.kmz

-9 is for best zip compression

This process can also be optimized by running:

zip -9 somefile.kmz somefile.kml

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.