You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to use SharpKml to scan a kml file for NetworkLink elements and replace them with their (current) downloadable content. For this I check all elements (using kml.Root.Flatten() if they are NetworkLink elements, get their URL and download the kml content. I parse that text and get another KmlFile object. Then I generate a new Folder object, clone and copy all features from the loaded KmlFile's Document in that new folder and try to replace the NetworkLink with that. I couldn't figure out that last part, though. My code looks mostly like this:
Kml insertKml = LoadKmlFromText(kmlToInsert);
var doc = insertKml.Feature as Document;
var folder = new Folder
{
Name = doc.Name
};
foreach (var featureToInsert in doc.Features)
folder.AddFeature(featureToInsert.Clone());
networkLink.Parent.AddChild(folder);
networkLink.Parent.RemoveChild(networkLink);
How is that supposed to work? Is it possible at all? Thanks!
The text was updated successfully, but these errors were encountered:
Thanks, that worked! I had to check if it's really a Container or the Kml element (when the NetworkLink is the only and topmost element), but that works. I also had to do a workaround when networkLink.Id is null; I generated a temporary Guid that's then used to remove the feature again.
I'd like to use SharpKml to scan a kml file for
NetworkLink
elements and replace them with their (current) downloadable content. For this I check all elements (usingkml.Root.Flatten()
if they areNetworkLink
elements, get their URL and download the kml content. I parse that text and get another KmlFile object. Then I generate a newFolder
object, clone and copy all features from the loaded KmlFile's Document in that new folder and try to replace theNetworkLink
with that. I couldn't figure out that last part, though. My code looks mostly like this:How is that supposed to work? Is it possible at all? Thanks!
The text was updated successfully, but these errors were encountered: