Packaging content in a KMZ file

The best stories told in Google Earth tend to make use of images. KMZ files offer a great way to bundle your placemarks with the images they reference. This tutorial shows you how to make the best use of what KMZ files offer.

Tutorial Contents

Prerequisites

  • In April 2017, Google Earth on Web was released, which puts Earth on the browser. However, for this tutorial, you will need Earth for Desktop installed on your computer. Download the latest version here.

What is a KMZ file?

KMZ files are very similar to ZIP files. They allow you to package multiple files together, and they compress the contents to make downloading faster. This allows you to bundle images along with your KML file if you want.

You can easily create KMZ files using Google Earth. When you save a placemark or folder from your Places panel you have the choice to save your content as a KMZ file or a KML file. This is similar to the way that web browsers allow you to save complete web pages, including images and style sheets, or just the HTML for a single web page.

Here's a video covering some of the basics of KMZ files using Google Earth Pro:

Learn why KMZ files can be useful for Google Earth content


When to use the KMZ file format

Here are some general tips on when you might want to use KML instead of KMZ and vice versa. Note that these are guidelines, and you're free to choose the approach that best suits your needs


Develop your content as a simple KML file.

Don't worry too much about KMZ files when you're starting a new project. It's good practice to organise any images you use into a small number of folders, but don't worry about packaging your work into a KMZ until later.


Publish your content as a KMZ file.

When you're ready to distribute your content to others – whether you're posting a file on the web, emailing an attachment to a colleague, or preparing for a presentation in front of a live audience – save your KML file and any images you want to include as a KMZ file.

When you make a KMZ file, you don't have to include images. A KMZ file can simply be a compressed version of a KML file without any multimedia files included. At the very least, you'll make a smaller file that will download faster.


Deciding on a project type

Before starting a new project using Google Earth, think about the goal of that project:

  • If you want your KML file to reference images on the web, you'll need a web-dependent project.

  • If you intend to present your project without internet access or to distribute your content to a private group, you'll need a self-contained project.


Tips for web-dependent projects

Sometimes you'll want your placemarks to reference images on the web. This could come in handy if you will be updating the images periodically, you want to include attributed images from another site, or if you simply want to reduce the download size of your KMZ file.

Here are a few tips for using images on the web in your KML file:

  • Post any images that your placemarks need in a publicly accessible location on your web server

  • If you want to view your KML or KMZ in Google Earth (v9) on web, then you will need to make sure the server that hosts your images and other files provides appropriate CORS headers, or Earth on web won't be able to access them. This is usually a question for your webmaster.

  • In your KML file, refer to each image on your web site using its absolute path. An absolute path is the full url to the image, such as http://www.google.com/images/google_sm.gif, rather than a relative path, like images/google_sm.gif.

  • Create a KMZ file that includes only your KML file.

  • Publish your new KMZ file on your web server.

Here's a simple video example of making a KMZ file (without including images) and publishing it on the web:

Using KMZ files for web-dependent projects

Here are some links and resources mentioned in the video:


Tips for self-contained projects

If you're planning to send around your content to a private group or are presenting it in a location that has limited or no internet access, consider bundling any images your placemarks reference as a part of your final KMZ file. Google Earth does this automatically for you if the images you use in your placemarks are on your computer's hard drive.

Before you start creating a self-contained project, complete the section on web-dependent projects above.

Here are a few tips:

  • Make sure that any images you want to include in your KMZ file are on your computer's hard drive.

  • If you copied images from the web to your hard drive, make sure your placemarks reference the images on your hard drive, not the originals on the web.

  • Create a KMZ file using Google Earth that reads your KML file and automatically collects the images it needs for the KMZ file from your hard drive.

  • Send an email to your colleagues with your new KMZ file attached.

Here's a video example of creating a KMZ with images included. The video is broken into two parts:

Using KMZ files for offline projects (1/2)

Using KMZ files for offline projects (2/2)


A few warnings

The tips above are designed to help you avoid some of the common pitfalls and questions you might run into. There are always trade-offs for each choice you make in designing your KMZ. Here are a few warnings to help you minimise any problems that might occur:

  • If one of your placemarks refers to images on your web site using relative URLs (such as "images/myphoto.jpg"), the images won't display properly in Google Earth. For the most part, relative paths should only be used to refer to images included in the KMZ file.

  • If you create a KMZ file with the Save as option in Google Earth, it will only include images on your computer in the KMZ file. Any media on the web won't be packaged with it.

  • If you download a KMZ file, and then save it as a KML file, your placemarks will refer to the images in the original KMZ file. Anyone else who tries to use your new KML file won't see the images, since they're on your hard drive rather than packaged in a KMZ file.


Discussion and Feedback

Have questions about this tutorial? Want to give us some feedback? Visit the Google Earth Help Community to discuss it with others.


What's Next