Search code examples
kmlkmz

how to add multiple KMLs into a KMZ?


can i have multi KMLs in a single KMZ?

so that when loading the kmz it will load all the kml inside it?

found this old discussion but the offered solution seems to not work. is there something i missing?


Solution

  • A KMZ which is a ZIP file with a .kmz file extension that can contain a single or multiple KML files. The first KML entry in the KMZ file is the root KML, which is typically named "doc.kml". Subsequent KML files can only be displayed if the root KML has a NetworkLink with a reference to it.

    Here is an example of a root KML file in a KMZ file that includes at least two sub-KML files.

    <?xml version="1.0" encoding="UTF-8"?>
    <kml xmlns="http://www.opengis.net/kml/2.2">
        <Document>
            <NetworkLink>
                <Link>
                    <href>test1.kml</href>
                </Link>
            </NetworkLink>
            <NetworkLink>
                <Link>
                    <href>test2.kml</href>
                </Link>
            </NetworkLink>
            ...
        </Document>
    </kml>
    

    More details on KMZ files are found here.