I have many large KML datasets that are served using a network link hierarchy in a region; as described in the KML link :
Using areas in conjunction with NetworkLinks, you can create a hierarchy of pointers, each of which points to a specific subregion. <viewRefreshMode>as shown in the following KML file, has the onRegion parameter, which sets the region to load data only if the region is active. If you provide nested regions with several levels of detail, more data is only loaded when the user's point of view launches the next load.
This works well when uploading to Google Earth.
Now I want to download them to the application using the Google Earth plugin . And I need to access the downloaded content using the Google Earth API; (i.e. attach click events, change styles) to integrate content into the application.
The problem is that I did not find the on-load event links for network links. In my opinion, this will work:
- Download the top-level network link through the API by adding a callback function that will be called when the network link is loaded.
- In the callback function, parse the KML returned by the network link. For intermediate levels in the regionalization hierarchy, this KML will contain only network links to the next regionalization level. Load them into the plugin via the API, again specifying the same callback function that will be called when they are loaded (i.e. when their area becomes visible).
- In the end, the returned KML will contain the actual "content". At this point, we load the actual content (i.e. tags) into the plug-in after making any desired changes (for example, adding listener events, tuning styles, etc.).
, javascript .
: , . , .
var networkLink = ge.createNetworkLink("");
networkLink.setName("Regionated hierarchy root");
var link = ge.createLink("");
link.setHref("http://foo.com/regionatedRoot.kml");
networkLink.setLink(link);
networkLink.onLoad = networkLinkLoaded;
ge.getFeatures().appendChild(networkLink);
function networkLinkLoaded(kml) {
for (childNetworkLink in parseNetworkLinks(kml)) {
childNetworkLink.onLoad = networkLinkLoaded;
ge.getFeatures().appendChild(childNetworkLink);
}
for (placemark in parsePlacemarks(kml)) {
ge.getFeatures().appendChild(placemark);
}
}
?
? , KML, , API.
, :
, - Google , . (, 5 ). , , - .
?