debracey

Problem Loading KML Network Links

Discussion created by debracey on Apr 24, 2014
Hello All,

I am just starting out with the WPF SDK (version 10.2.2) and I'm having some trouble getting it to ingest a KML network link. The link is created and loaded as follows:

KmlLayer kmlLayer = new KmlLayer();
Uri uri = new Uri(@"C:\Temp\TopLevel-NetworkLink.kml");

kmlLayer.Url = uri;
kmlLayer.Visible = true;
kmlLayer.DisableClientCaching = true;
                   
kmlLayer.Initialize();
this.MyMap.Layers.Add(kmlLayer);


This part appears to work fine, and I can see the network link appear in the layers panel that I've bound to the map. The Network Link KML is structured as follows:

<kml xmlns="http://earth.google.com/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2">
  <Document id="RootFolder">
     <name>Root Folder</name>
     <NetworkLink id="UpdateLink">
       <name>Update Link</name>
       <Link>
          <href>http://localhost:8000/linkUpdate.kml</href>
          <refreshMode>onInterval</refreshMode>
          <refreshInterval>30</refreshInterval>
       </Link>
     </NetworkLink> 
  </Document>
</kml>


The link in the HREF generates Network Link Control messages as follows

<?xml version="1.0" encoding="utf-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2">
 <NetworkLinkControl>
  <Update>
   <targetHref>http://localhost:8000/linkUpdate.kml</targetHref>
   <Create>
    <Document targetId="RootFolder">
     <Placemark id="_1070">
      <name>Test Placemark</name>
      <description>
      </description>
      <StyleMap id="_1074">
       <Pair>
        <key>normal</key>
        <Style id="_1072">
         <IconStyle id="_1076">
          <color>FFFFFFFF</color>
          <scale>1.25</scale>
          <Icon id="_1075">
           <href>http://localhost:8000/icon.png</href>
          </Icon>
         </IconStyle>
         <LabelStyle id="_1077">
          <color>FFFFFFFF</color>
          <scale>0</scale>
         </LabelStyle>
        </Style>
       </Pair>
       <Pair>
        <key>highlight</key>
        <Style id="_1073">
         <IconStyle id="_1079">
          <color>FFFFFFFF</color>
          <scale>1.25</scale>
          <Icon id="_1078">
           <href>http://localhost:8000/icon2.png</href>
          </Icon>
         </IconStyle>
         <LabelStyle id="_1080">
          <color>FFFFFFFF</color>
          <scale>0.7</scale>
         </LabelStyle>
        </Style>
       </Pair>
      </StyleMap>
      <Point id="_1071">
       <extrude>0</extrude>
       <altitudeMode>clampToGround</altitudeMode>
       <coordinates>1.0,1.0,120</coordinates>
      </Point>
     </Placemark>
    </Document>
   </Create>
  </Update>
 </NetworkLinkControl>
</kml>


Unfortunately, none of this seems to work - and I don't see any of the icons on the map (I clipped the example somewhat). Interestingly, I can see ESRI making requests on the server at the interval specified in the KML, so that gives me reason to believe that things are working under the hood.

I'm just not sure where to go from here. The KML works fine in Google Earth (without any errors), is there a way to turn on some kind of debugging in ESRI? No exceptions are thrown, and no failure events (Initialization Failed, etc.) are raised. I have read through the KML documentation for the SDK, and I've made sure that the server is using the proper MIME type, and that all permissions are correct, but I'm still not getting anything.

A normal KML works just fine, so that leads me to believe that there's some problem specific to the network links, but I don't see what it is...

Thoughts?

Outcomes