I have a KMZ file which contains a KML file which in turn contains a KMZ file. I am using JTS for processing this with java. The current kml/kmz parser functionality trips up with the above use case.
Can someone please throw some light on this ?
I have a KMZ file which contains a KML file which in turn contains a KMZ file. I am using JTS for processing this with java. The current kml/kmz parser functionality trips up with the above use case.
Can someone please throw some light on this ?
A KMZ file is a zip archive, and should contain only one KML file at its root level (usually named "doc.kml"). If it contains more than one KML file, then Earth (or another KML renderer) will choose one KML file from the KMZ and render that one, and will ignore the others.
You could theoretically have more KML files in sub-folders in the zip, and reference them via NetworkLinks in the main KML, but I've never tried it to confirm that it works.
Since a KMZ file is a zip archive, and a KML file is an XML document, there's no way to have another KMZ file inside the KML, unless it's referenced via something like a NetworkLink.
Here is the KML documentation about KMZ files: https://developers.google.com/kml/documentation/kmzarchives
Google Earth does not support nested KMZ files (i.e., KMZ file entries within a KMZ file) and this is most likely not supported in JTS.
A KMZ file "contained within" a KMZ file may be structured in two ways:
KMZ file referenced from within another KMZ file.
KMZ file test1.kmz includes a doc.kml with NetworkLink with reference to test2.kmz which is a separate file. The file test2.kmz is located in same "folder" as test1.kmz. Alternatively, test2.kmz could be on another web server and test1.kmz uses the absolute URL to test2.kmz.
KMZ file within KMZ file -- this is not supported in Google Earth
KMZ file includes two entries: doc.kml + test2.kmz
and doc.kml has a NetworkLink with reference to "test2.kmz"
For option #2, recommend to either move the nested KMZ file to same file location as outer KMZ file or unpack the contents of nested KMZ files and add them directly to the parent KMZ file. You may need to create a folder for each nested KMZ file and change the URL reference in the NetworkLink that references it.
In practice, an external KMZ file referenced in another KMZ file (option #1) is not common since the recommended practice of a KMZ is having a self-contained KML scene including all icons, images, overlays, sub-KML files, etc. In this manner, a KMZ file is self-contained and can be e-mailed or even displayed in an off-line KML viewer.