Multiple KML files in a .KMZ

1,597 views
Skip to first unread message

rps

unread,
May 4, 2007, 3:00:08 PM5/4/07
to KML Developer Support - Getting Started
KMZ files
I have a number of separate .KML files containing tracklogs that I
wish to join into one so that when I open the combined file in Google
Earth I see all the tracks together. Is there an easy way to do this
without resorting to extensive editing?

I hoped that the multiple .KML files could simply be zipped into a
single .KMZ to achieve this effect. However, I find that when I open
in Google Earth a .KMZ created in this way Google Earth just shows one
of the KML files, not all of them.

TIA

Peter Seaman

barryhunter

unread,
May 5, 2007, 6:27:19 PM5/5/07
to KML Developer Support - Getting Started
As far as I am aware you can have multiple kml files inside a kmz
file, but it doesn't seem to be 'offically supported'.
The main trick is that Google Earth will only load the main 'doc.kml'
so in that you need create network links that reference the other
files to be able to load the content from them. So in affect your
doc.kml just becomes an index of your other files. (if you don't have
a doc.kml it seems to just laod the first .kml in the zip index it
seems, but if you do have a doc.kml it is loaded)

hope that helps!

rps

unread,
May 6, 2007, 4:01:29 PM5/6/07
to KML Developer Support - Getting Started
Thanks for that.

I created doc.kml as follows

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.0">
<NetworkLink>
<Link><href>t1.kml</href></Link>
<Link><href>t2.kml</href></Link>
<Link><href>t3.kml</href></Link>
</NetworkLink>
</kml>

doc.kml t1.kml t2.kml and t3.kml are all in the same local.
directory

I tried to open this file as a .kml (not a kmz) and I found that it
just displayed t3.kml. Have I done something wrong? I assume I would
get the same if I zipped all 4 files into a kmz.

Peter Seaman

barryhunter

unread,
May 6, 2007, 5:37:44 PM5/6/07
to KML Developer Support - Getting Started
I dont think you can have multiple <Link>s in a <NetworkLink>, but you
can have multiple <NetworkLink>s in a <Folder> and/or <Document>

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.0">

<Document>
<name>My Content><name>
<NetworkLink>
<name>Part 1</name>


<Link><href>t1.kml</href></Link>

</NetworkLink>
<NetworkLink>
<name>Part 2</name>


<Link><href>t2.kml</href></Link>

</NetworkLink>
<NetworkLink>
<name>Part 3</name>


<Link><href>t3.kml</href></Link>
</NetworkLink>

</Document>
</kml>

I have also added a sprinkling of <name> tags as they are much nicer
included as that you get nice titles in the 'Places' tree, on the left
hand side.

rps

unread,
May 7, 2007, 4:38:49 AM5/7/07
to KML Developer Support - Getting Started
Many thanks for that - it works fine now. (Initially the missing / in
your fourth line gave me a puzzling diagnostic)


Reply all
Reply to author
Forward
0 new messages