Images in KMZ not resolving

233 views
Skip to first unread message

Zoltan

unread,
Mar 13, 2011, 1:32:38 PM3/13/11
to KML Developer Support - Advanced Support for KML
I think I may be creating this KMZ file incorrectly. I have the image
in a folder in the KMZ file called "files" and my path to the image is
<href>files/Water lilies.jpg</href>. GE shows the image as a red X
instead of loading the image.

What am I doing wrong?

Z

GTrek

unread,
Mar 14, 2011, 12:49:35 AM3/14/11
to KML Developer Support - Advanced Support for KML
Hi Zoltan,

You’re doing nothing wrong, you just can't do what your trying to do.
The problem is that your trying to access your file system from within
a web browser object and that’s not allowed. If it was then any web
page you visit would have access to you entire computer file system
and imagine what a field day a virus or Trojan would have.

The are 2 ways to do this:-
1) Run an HTML or FTP server service on your PC and access the files
with a complete URL through this portal. I know it can be done but I
can’t help further here..
2) Upload your image files to a web server somewhere on the internet
and then point your href to the URL

Regards

John
www.gtrek.co.uk

Zoltan

unread,
Mar 14, 2011, 10:04:35 AM3/14/11
to KML Developer Support - Advanced Support for KML
So are you saying that a KMZ file cannot contain other files, only
reference files stored on a web site? What is the purpose of the KMZ
versus the KML then?

Reading the KMZ reference [url=http://code.google.com/apis/kml/
documentation/kmzarchives.html]here[/url], it says: "A KMZ file
consists of a main KML file and zero or more supporting files that are
packaged using a Zip utility into one unit, called an archive."

Also, I am not using a Web browser. I am using the stand-along Google
Earth application installed locally. So there should be no reason why
it cannot access my file system.

Nymor

unread,
Mar 14, 2011, 10:19:28 AM3/14/11
to KML Developer Support - Advanced Support for KML
I'm with you there Zoltan - while I do usually host my image files I'm
positive I've used the method you are trying before - although, of
course, I could be mistaken.

As you say that's the whole point of KMZ files - to wrap all the
necessary contents within one file.

Could you post the KMZ file (or a simplified version that shows the
problem) to a url somewhere or to the files section of this forum
(available in the righthand sidebar).

Regards
Nymor

Zoltan

unread,
Mar 14, 2011, 10:34:10 AM3/14/11
to KML Developer Support - Advanced Support for KML
Also, If I rename the KMZ file to ZIP and unzip it to a folder, I can
open the KML with "files" folder in the same directory and the images
will resolve in GE. So the reference to the images are proper, it
just can't get to them when they are in the KMZ file.

Is there a way I can attach a file to this thread?

Zoltan

unread,
Mar 14, 2011, 11:29:54 AM3/14/11
to KML Developer Support - Advanced Support for KML
Here is the KMZ file in question:

http://dl.dropbox.com/u/4198162/Zoltan%20House.kmz

GTrek

unread,
Mar 15, 2011, 4:51:11 PM3/15/11
to KML Developer Support - Advanced Support for KML
Hi all,

I totally agree with you all. Try opening the KMZ in Google Earth,
it'll work then. Oops no it won't.

I've opened the kmz and looked at the doc.kml and can’t immediately
see what’s wrong so I changed a few minor things, zipp’ed it up again
and hey presto it displayed correctly !!. I then took the original
doc.kml and the files folder and zipp’ed this up and again it works
OK. It looks like the problem has something to do with the way in
which you Zip the files.

I had a similar problem a while back using the .NET zip utility and it
worked in Google Maps but not in Google Earth so I used another
utility. What I’m using to test here is WinRar to create the .ZIP and
then rename it .KMZ.

Try it this way and see it works for you. If you would like me to send
you the .ZIP file I created send me an email address (go to my
website).

Regards

John
www.gtrek.co.uk

Zoltan

unread,
Mar 15, 2011, 5:08:19 PM3/15/11
to KML Developer Support - Advanced Support for KML
Hey GTrek,

It sounds like you are on the right path about the Zip format. I am
using SharpZipLib to create the KMZ and I had to go through a bit of
trouble and research on this forum to even get it to where GE thinks
it is a valid file.

Which .NET Zip utility did you end up using?

Z

GTrek

unread,
Mar 16, 2011, 6:48:51 AM3/16/11
to KML Developer Support - Advanced Support for KML
Hi Zoltan,

I tried a few but ended up using IonicZip v1.6 although I think the
currect version is 1.9, it worked just fine and is easy to use too. Go
to http://dotnetzip.codeplex.com/ . It's donationware and it's well
worth a few bucks as it all goes to charity.

Let me know if it works or you need any other info.

Regards

John
www.gtrek.co.uk

Zoltan

unread,
Mar 16, 2011, 10:13:18 AM3/16/11
to KML Developer Support - Advanced Support for KML
OK. That worked. Good to know. SharpZipLib was not creating KMZ files
correctly and IonicZip does.

Thanks for all of the help, folks.

Z

On Mar 16, 6:48 am, GTrek wrote:
> Hi Zoltan,
>
> I tried a few but ended up using IonicZip v1.6 although I think the
> currect version is 1.9, it worked just fine and is easy to use too. Go
> tohttp://dotnetzip.codeplex.com/. It's donationware and it's well
Reply all
Reply to author
Forward
0 new messages