Question

I had close to 100,000 KML files that just contained names, descriptions, polygons and points of different locations, that I have combined into one large KML file. I'm now just trying to create a network link to this KML file from Google Earth that will only load this information for the places within the bounding box of the screen. Currently, it tries to load everything at once which understandably just crashes google earth.

Has anyone done anything like this before and know a way to go about it?

Thanks in advance (:

Was it helpful?

Solution

Combining many KML files via NetworkLinks in a single parent KML file must be done such that all the links and features are not loaded at once as you're seen -- result: crashing Google Earth.

You need to break up your KML features into smaller KML files each in its own bounded region then have the single KML file (parent KML) load each sub-KML via a NetworkLinks with a Region element in the NetworkLink. Ideally the regions of the KML files are largely non-overlapping to minimize the number of files opened at once.

The parent KML should have each NetworkLink with the appropriate Region and Level of detail (Lod) element to prevent all of the KML files from loading all at once.

Here's the structure of the parent KML file:

<kml xmlns="http://www.opengis.net/kml/2.2">
 <Document>
  <NetworkLink>
    <name>area 1</name>
    <Region>
      <LatLonAltBox>
        <north>xx</north>
        <south>xx</south>
        <east>xx</east>
        <west>xx</west>
      </LatLonAltBox>
      <Lod>
        <minLodPixels>32</minLodPixels>
      </Lod>
    </Region>
   <Link>
    <href>1.kml</href>
   </Link>
  </NetworkLink>

  <NetworkLink>
    <name>area 2</name>
    ...
  </NetworkLink>
  ...
 </Document>
</kml>

Note: value of minLodPixels may vary depending on the size of the particular region. Experiment with different values: 32, 64, 128, etc. until you get the behavior you're looking for.

You can use this KML file to measure the screen in pixels. It provides a screen overlay with adjustable pixel widths in both the horizontal and vertical direction.

In addition to Regions, you could simply make each NetworkLink not visible [set visibility to 0] then the user must manually check it to fetch the contents. If applicable, you can also apply a folder radio style to only allow one of a group of NetworkLinks to load. That's the simplest method to make a KML scale.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top