Contents of kmz file

213 views
Skip to first unread message

2005yvr

unread,
Oct 17, 2006, 6:03:04 PM10/17/06
to KML Discussions
I have a question about kmz.

When a kmz file contains a few kml file, which file is applied?
I tried to open a few sample kmz files with Google Earth, it seems most of kmz file contains just only one doc.kml file.
So I made my kmz file which contains two kml file(burnaby.kml, a_burnaby.kml), when I open this kmz file with Google Earth, always burnaby.kml is read and a_burnaby.kml is ignored.
These two kml files are almost same, They don't have <NetworkLink> tag.
Even though I renamed a_burnaby.kml to z_burnaby.kml and made a kmz file,
I opened this kmz file with Google Earth, only burnaby.kml was read.
I made a kmz file with WinZip.

Does anyone have any idea? Thank you very much!

ManoM

unread,
Oct 17, 2006, 7:46:25 PM10/17/06
to KML Discussions
Hi 2005yvr,

I don't know which one is read first but only one KML file in a KMZ file will be read, so you should separate them into two different files.

KMZ files are meant for compressing larger KML files and allowing you to package any image files and models that you need with the file, instead of hosting it on a server.

ManoM

simon_a

unread,
Oct 18, 2006, 5:29:05 AM10/18/06
to KML Discussions
Hello,

This is rather academic really because, as ManoM said, only one KML file will be read but, if you're interested, it appears that the timestamp on the file is the deciding factor.

I also tried two files where the timestamps were the same to-the-minute and then it picked the first file alphabetically.

So there you go - pretty pointless excercise but I feel much better now

Cheers,

Simon.

LuciaM

unread,
Oct 18, 2006, 5:59:20 AM10/18/06
to KML Discussions
good sleuthing!

2005yvr

unread,
Oct 18, 2006, 6:18:14 PM10/18/06
to KML Discussions
Thank you for your responses.

Actually I tried the kmz file which contains two kml files(aburnaby.kml, burnaby.kml), both kml file's timestamp are same, jsut the difference is their name.
I expected that 'aburnaby.kml' would be read, but as a result, 'burnaby.kml' was read.
It makes me more confused.
I read the KML API, but it didn't say anything about the contents of kmz file.
If API said it is allowed a kmz file has only one kml file, it would be make sense.
But somehow I can open the kmz file which contains two kml files with GoogleEarth.
Still I'm not sure...

2005yvr

ManoM

unread,
Oct 18, 2006, 6:27:48 PM10/18/06
to KML Discussions
Sure, you can open it. But as you said, only one of the KML files is actually used. GE knows that a KMZ file can contain a KML file, so it opens it and looks for the first one, in whatever order it decides something is "first". Then it opens that and ignores other files in the KMZ. Or, more precisely, it checks for links to them in the KML file that it opened. Since there are no links to your second KML file, it does nothing with it.

2005yvr

unread,
Oct 18, 2006, 7:31:51 PM10/18/06
to KML Discussions
As I tested a lot, it seems only one kml file is read from a kmz file.
I understood that.
The point is how 'the first kml file' is chosen from a kmz file.
Even if I tried the different file names and different timestamp, I didn't see any rule.
And KML API doesn't say anythning.

BrianT

unread,
Oct 19, 2006, 3:32:15 AM10/19/06
to KML Discussions


Acting on a tip from Brian Flood that you can now pack multiple KML files into a single KMZ, I hacked up a regionated scheme to display 20,000 polygons in the state of Wyoming using 1400+ separate KML files.

After a couple of hours of hair-pulling, I realized that the time-stamp was making the difference.

Since we're making our KML and compressing into KMZ dynamically on a server using PHP, we could fiddle with the time-stamps and everything would be fine. However I was in a hurry and simply renamed my initial KML file doc.kml and then renamed my other files with a .txt extension (and changed the <href> tags accordingly).

Long story, longer--everything works like a charm and I have a Regionated 9.3mb standalone KMZ file that streams very nicely (...once it completely loads (@ 40 secs)).

BT

regionator

unread,
Oct 23, 2006, 9:03:20 AM10/23/06
to KML Discussions
Or just push everything down a level and put exactly one .kml
in the top directory with a NetworkLink down to the root of the hierarchy.
As attached...
655167-a.kmz
Reply all
Reply to author
Forward
0 new messages