Referencing images to create a KMZ file

3,625 views
Skip to first unread message

KeithM

unread,
Jun 14, 2011, 4:32:20 PM6/14/11
to kml-support-g...@googlegroups.com
My KML file is a collection of points and when i open it in GE, it looks great. I created a sub-folder called "Images" where i have 4 images stored. I am trying to create a KMZ file by "Save Place As". The output KMZ is put into a different folder. My ScreenOverlay image shows up fine. The icon for each point shows up fine too:
1. <href>Images/fcc.png </href>
2. <href>Images/tower.png</href>

What does not show up are the two images that are 'embedded' in the balloons (html):
1. <center> <img src="Images/fcc2.png" width="50" height="37"></a> </center>
2. <img src="Images/am_tower.png" alt="image" width="210" height="220" border="0" align="bottom" /></a></p></td>

When creating a KMZ, do I have to add something different in order to get images [referred by html] to show?

Josh L

unread,
Jun 16, 2011, 1:52:54 PM6/16/11
to KML Developer Support - Getting Started with KML
Hi there,

Check out an example of doing this (and more) at
http://code.google.com/apis/kml/documentation/kmzarchives.html
although it sounds at first glance like things should be working. If
you are still having trouble please provide a link to a short sample
KMZ that's not working as you expect.

Cheers,

-Josh

KeithM

unread,
Jun 20, 2011, 5:15:11 PM6/20/11
to kml-support-g...@googlegroups.com
hey Josh, thank you for the link, there is some good information there. well, i created the .kmz file and put it into the same separate folder and the images showed up. i didn't change anything so i am not sure why that worked. when i tried opening the .kmz in a totally different computer the images didn't show-up. i should also note that the images that are not working are not only have the html code but are also the images that are embedded in balloons. i am a bit stumped....hmmmm....

Jason M

unread,
Jun 22, 2011, 8:39:19 AM6/22/11
to KML Developer Support - Getting Started with KML
Hi.

The key with working with KMZ files is opening the KMZ as a ZIP file
in WinZip or whatever then looking at the file structure and making
sure the relative URLs in the links match the structure. Sometimes the
links get mismatched.

The tutorial Josh listed above should help to understand the structure
of a KMZ file.

The KMZ basically mirrors the structure of a webserver document root
and its root "doc.kml" file is essentially like a web page that
includes embedded images.

Sometimes KMZs appear to work on one computer simply because the
images exist at the same relative level as the KMZ file itself and the
images are being fetched from the local file system and not from the
KMZ file so it doesn't work when the separate image files are no
longer present on another computer.

--jason

KeithM

unread,
Jun 22, 2011, 11:20:47 AM6/22/11
to kml-support-g...@googlegroups.com
Jason, thank you for the response. yes i understand what a KMZ file is at an elementary level but two of the four images (included in the KMZ "zip") show up while the other two images don't. i attached the kmz file for if (or when) someone has the time to see what i am doing wrong.
amt.kml

Rossko

unread,
Jun 22, 2011, 1:56:14 PM6/22/11
to KML Developer Support - Getting Started with KML
> ... My ScreenOverlay image shows up fine. The icon for
> each point shows up fine too:
> 1. <href>Images/fcc.png </href>
> 2. <href>Images/tower.png</href>

These relative URLs are interpreted by the KML parser, it knows to
look inside the KMZ as described in
http://code.google.com/apis/kml/documentation/kmzarchives.html

> What does not show up are the two images that are 'embedded' in the balloons
> (html):
> 1. <center> <img src="Images/fcc2.png" width="50" height="37"></a> </center>
> 2. <img src="Images/am_tower.png" alt="image" width="210" height="220"
> border="0" align="bottom" /></a></p></td>

So far as the KML parser is concerned, those are just strings of
text. They get passed over to the browser component to render the
HTML. The browser knows nothing about KMZ and applies the relative
URL to the root of the "webpage" it is rendering.
I'm not sure if that is intended behaviour or not.

Rossko

unread,
Jun 22, 2011, 2:04:47 PM6/22/11
to KML Developer Support - Getting Started with KML

KeithM

unread,
Jun 22, 2011, 2:08:03 PM6/22/11
to kml-support-g...@googlegroups.com
Rossko, thank you for your response. that makes a lot of sense. the HTML that the parser passes over is originally from a Export-to-KML (v.2.5.4) ArcScript in ArcMap v.10.  In this case what code should i use so it can read and display those images? Thank you!

KeithM

unread,
Jun 22, 2011, 3:37:18 PM6/22/11
to kml-support-g...@googlegroups.com
thank you to all for your responses. i understand the link to the Jimmy Buffet KMZ, it is a great example. i am not trying to be the annoying newbie and i really want to learn this. i have attached screenshots of what i am using in ArcMap to create the original KML file. The ArcScript requires the use of HTML to create both the Layer Description and Feature Description balloons. 

If the original shapefile was just 5 or 6 points, i'd just manually put-in the KML code and not deal with the HTML balloons in the ArcScript. However, this (and many others i work with) has thousands of points.
LayDesc02.JPG
LayDesc01.JPG
Message has been deleted

Jason M

unread,
Jun 26, 2011, 8:22:27 PM6/26/11
to KML Developer Support - Getting Started with KML
This might be completely obvious but if you rename the amt.kml file
you posted with a .kmz extension then all images appear to display
correctly.

Google Earth performs slightly different parsing if input file has a
KML vs KMZ file extension even through it correctly opens .KMZ files
labeled as .KML.

The tower.png image for example won't display if you load the KMZ file
having a .KML extension on Windows...

A bug has been reported for this issue:
http://code.google.com/p/earth-issues/issues/detail?id=1230

--j

KeithM

unread,
Jun 27, 2011, 10:09:09 AM6/27/11
to kml-support-g...@googlegroups.com
Thank you Jason, changing the extension from .kml to .kmz does not work when i try to open that .kmz file in another folder on my computer. it seems that the HTML code is not being read but if an Arc user [using Export-to-KML] is required to input html, how does someone get an image to display using that script?

Thank you!

KeithM

unread,
Jul 12, 2011, 9:18:56 AM7/12/11
to kml-support-g...@googlegroups.com
FYI: i had contacted the author of the Export to KML Arc script. For anyone using the Export to KML Arc script (which requires you to use HTML) and you need to create a KMZ from a KML (w/ images) the best way to be sure your images come through into the KMZ file is to keep the following in mind: "Because the browser is interpreting the HTML in the feature description, it can't find the images. So it's a best practice to post any images used in the feature description to the web, and use the full image URL in the description."  Thanks for your help everyone.
Reply all
Reply to author
Forward
0 new messages