Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
442 views
in Technique[技术] by (71.8m points)

kml - Nesting KMZ files

Is it possible to create one KMZ file that is composed of several smaller KMZ files? I would prefer to not have to manually merge the actual KML entities, but I will if that's the only option.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

A KMZ file can have any number of inner KML files (NOT KMZ files). But the first entry in the KMZ file must be the root KML file (typically named doc.kml), which may include network links with references to other KML or KMZ files. Several inner KML files, for example, could reference a shared style (in another KML file) via relative URLs.

The inner KML files can nest to any level of depth to other KML files so you can create a hierarchy of nested KML files.

KMZ files within KMZ files is not supported in Google Earth so that is not recommended. If you want a root KMZ file to reference other sub-KMZ files then the sub-KMZ files should not be sub-entries of the root KMZ file but located at the same relative context in the web server or file system.

Here is what a root KML file in a KMZ file would look like 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>

You can set visibility tag to 0 or add radio folders to selectively load inner KML files or add Region elements to load when given region is active. This would be needed to scale to lots of Features to achieve good performance.

Reference: https://developers.google.com/kml/documentation/kmlreference#networklink


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...