0

I have multiple KMZ files created with gdal_translate using geoTiffs as inputs. The individual KMZ files all open and display correctly in Google Earth but I would like to group the KMZ files into another KMZ file for better organization. I have tried JasonM1's suggestion in the "Nesting KMZ file" thread but the images do not get displayed. Google Earth reads the parent KMZ file and flys to the correct location but no overlay is displayed. How do I load the images? The top level doc.kml file is shown below. Thanks!

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
    <Document>
      <NetworkLink>
         <open>1</open>
         <refreshVisibility>1</refreshVisibility>
         <flyToView>1</flyToView>
         <Link>
            <href>out_1.kmz</href>
         </Link>
      </NetworkLink>
      <NetworkLink>
         <Link>
            <href>out_2.kmz</href>
         </Link>
      </NetworkLink>
      <NetworkLink>
         <Link>
            <href>out_3.kmz</href>
         </Link>
      </NetworkLink>
   </Document>
</kml>
Community
  • 1
  • 1
nak
  • 1
  • I'm guessing [Nesting KMZ files](http://stackoverflow.com/questions/2109555/nesting-kmz-files) is the question you are referencing? There are 7.7 million questions on Stack Overflow right now, so if you are referencing a specific question, it is helpful if you actually provide a link. (which I see the @JasonM1 has edited in) – psubsee2003 Jul 25 '14 at 23:17
  • What is the snippet of KML that references the missing overlay? What is the raw KML reference and what does Google Earth think the URL is? – CodeMonkey Jul 27 '14 at 03:45

1 Answers1

0

The images within a KMZ file are referenced as relative URLs that are relative to the root KML document.

Suppose the out_1.kmz file has a root kml file named doc.kml with this reference to an overlay image:

<kml xmlns="http://www.opengis.net/kml/2.2">
    <GroundOverlay>
        <Icon>
          <href>overlay.jpg</href>
        </Icon>
    </GroundOverlay>
</kml>

If, however, the root KML accesses another KML file in a sub-folder then references in the target KML document will be relative to the target KML document location (i.e. relative to the sub-folder).

If you reference a target KMZ file from a KML or KMZ file the relative links to images within the KMZ will be unchanged.

If you're trying to restructure the contents of one or more KMZ files then the relative URLs to the referenced image must be consistent to the new structure.

CodeMonkey
  • 22,825
  • 4
  • 35
  • 75
  • that helps my understanding. But are all references relative to the top level? – nak Jul 29 '14 at 19:05
  • References are relative to the particular KML document. For the root KM document all references relative to top level. A KML document in sub-folder will have refs relative to it and so forth. – CodeMonkey Jul 29 '14 at 19:06
  • Sorry first time user. @Jason, that helps my understanding. But are all references relative to the top level? The KMZ files are super-overlay files containing multiple folders, and hundreds of kml and png files. But the lowest level kml ("0.kml") seems to assume the png file to display is in the same folder as the "0.kml" file. It uses 0.png I would add code but there is a character limit in comments. – nak Jul 29 '14 at 19:16
  • If all KML files are at root-level then all refs are relative to top level. – CodeMonkey Jul 29 '14 at 19:43