Customer Service | Training | Contact Us
You are here: Home > User Forums > arcgis server forums > Thread Replies

ArcGIS Server Forums

ArcGIS API for Silverlight forum

KML support?   Kirk Kuykendall May 21, 2009
Re: KML support?   Morten Nielsen May 21, 2009
Re: KML support?   Kirk Kuykendall Jun 19, 2009
Re: KML support?   Morten Nielsen Jun 19, 2009
Re: KML support?   Daniel Walton Dec 18, 2009
Re: KML support?   Rex Hansen Dec 20, 2009
Re: KML support?   Daniel Walton Jan 21, 2010
Re: KML support?   Morten Nielsen Jan 21, 2010
Re: KML support?   Daniel Walton Jan 21, 2010
Re: KML support?   Morten Nielsen Jan 21, 2010
Re: KML support?   Daniel Walton Jan 21, 2010
Re: KML support?   Morten Nielsen Jan 21, 2010
Re: KML support?   Daniel Walton Jan 21, 2010
Re: KML support?   Morten Nielsen Jan 21, 2010
Re: KML support?   Daniel Walton Jan 21, 2010
Report Inappropriate Content • Top • Print • Reply    
Subject KML support? 
Author Kirk Kuykendall 
Date May 21, 2009 
Message I'm interested in leveraging the Google Maps Data API ... http://code.google.com/apis/maps/documentation/mapsdata/

... but I don't see any support for KML in silverlight.

libkml is written in C++, with no signs of a SWIG wrapper for C# (hey google, benign neglect== evil)
http://code.google.com/p/libkml/issues/detail?id=16

Since ArcGIS Explorer supports KML, it seems like ESRI could do the same for silverlight. To do it right though, I guess a KML-XAML translator would be needed so maybe this is something microsoft should do.

PS: seems like MS would have to be working on this already as part of their Virtual Earth SL control. 
  Kirk Kuykendall
AmberGIS Programming Services & Sales
web: http://www.ambergis.com
blog: http://ambergis.wordpress.com/
LinkedIn: http://www.linkedin.com/in/kirkkuykendall 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: KML support? 
Author Morten Nielsen 
Date May 21, 2009 
Message We will be providing a KML layer in the next snapshot. 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: KML support? 
Author Kirk Kuykendall 
Date Jun 19, 2009 
Message Hi Morten -

I don't see KML support in build 255. Are there any plans to add it?

Thanks, Kirk 
  Kirk Kuykendall
AmberGIS Programming Services & Sales
web: http://www.ambergis.com
blog: http://ambergis.wordpress.com/
LinkedIn: http://www.linkedin.com/in/kirkkuykendall 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: KML support? 
Author Morten Nielsen 
Date Jun 19, 2009 
Message Keep an eye on the CodeGallery. Should be up there very soon.
 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: KML support? 
Author Daniel Walton 
Date Dec 18, 2009 
Message Morten,

I see that the KML classes and WMS classes received an update on Dec. 8. Is there any documentation as to what changes, if any, were made? Also, should we expect any further development by ESRI on KML related classes? I am about to spend my free time this Christmas working on implementing folders, checkbox trees, and self-refreshing network links for KML, but I might be willing to hold off if somebody way smarter were already working on these things.

Regards, 
  Dan Walton
GIS Fire Tools
Real Time Wildfire Image Processing and Situational Awareness
http://gisfiretools.com/firehawk.web/ 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: KML support? 
Author Rex Hansen 
Date Dec 20, 2009 
Message Hi Daniel,

The Dec. 8 update to the KML layer sample merely upgraded the sample to work with version 1.1 of our SL/WPF API. That said, we just updated the sample again with enhanced support for marker symbol rotation and scale, and StyleMap tags.

The Dec. 8 update to the WMS layer sample included support for WPF.

There are no current plans to enhance either the KML or WMS layer over the next few weeks. We definitely encourage you to download and extend the current samples... if you'd like to contribute your enhancements, even better. Feel free to respond on this thread when you've put something together.

Thanks!
-Rex 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: KML support? 
Author Daniel Walton 
Date Jan 21, 2010 
Message I have updated the KmlLayer class to display refreshing network links, but alas I don't really like the way I have coded it. KmlLayer inherits GraphicsLayer, which has a single collection of Graphics objects. So if a KML file has multiple network links, all the sub-layers have to dump their graphics objects into the root layer with an attribute identifying which layer they belong to. On refresh (invoked by a DispatchTimer) the root layer has to remove these objects and re-download and re-parse the network link content.

I would prefer to keep the graphics objects contained within each KmlLayer object and override or replace the routine that actually displays the graphics. Is this possible? If so, what would be the best approach? (My initial stab-in-the-dark guess is to replace GetEnumerator().)

Thanks for your help, 
  Dan Walton
GIS Fire Tools
Real Time Wildfire Image Processing and Situational Awareness
http://gisfiretools.com/firehawk.web/ 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: KML support? 
Author Morten Nielsen 
Date Jan 21, 2010 
Message I'm not really sure what you are asking here, but if you would prefer to keep the graphics objects, don't remove them in the first place. If you need to update some of them, only update the graphics you need to update.

There's not really anything you can tab into that displays the graphics. It's all handled internally by Silverlight. You can control the template used to create the visual object (Symbol.ControlTemplate) but the rest is simply handled by Silverlight. All the ESRI API really does is adding the visuals to a Panel. 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: KML support? 
Author Daniel Walton 
Date Jan 21, 2010 
Message Basically I am asking, if I want to override some method or member of the GraphicsLayer class so that Silverlight will display Graphic objects from child KmlLayer objects, can I do it and how? See my initial attempt below which does not work: 
 
public class KmlLayer : GraphicsLayer
{
  internal GraphicCollection graphics;
  internal List<KmlLayer> ChildLayers;

  public new GraphicCollection Graphics
  {
    get 
    {
      GraphicCollection gc = new GraphicCollection();
      foreach(Graphic g in this.graphics)
        gc.Add(g);
      foreach(KmlLayer kl in this.ChildLayers)
        foreach(Graphic g in kl.Graphics)
          gc.Add(g);
      return gc;
    }
    set { return this.graphics; }
  }
.
.
.
}
 
  Dan Walton
GIS Fire Tools
Real Time Wildfire Image Processing and Situational Awareness
http://gisfiretools.com/firehawk.web/ 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: KML support? 
Author Morten Nielsen 
Date Jan 21, 2010 
Message How is your "gc" object so different from this.Graphics?
The neat thing about the Graphics property is that changes to its collection or graphics in it is automatically detected and updated on the map. But also be aware that it can be expensive to remove/re-add graphics since they would have to be re-rendered, so only update graphics that has changed.
You code would basically be: 
 
foreach(KmlLayer kl in this.ChildLayers)
    foreach(Graphic g in kl.Graphics)
        if(!this.Graphics.Contains(g))
            this.Graphics.Add(g);

//also note that GraphicsLayer.Graphics is settable as well if you prefer modifying the entire instance itself
 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: KML support? 
Author Daniel Walton 
Date Jan 21, 2010 
Message That's basically the way I have it working now. I was hoping to be able to use a more nestable solution and let each sub-layer keep its own graphics objects to prevent cross-thread issues associated with multiple child layers accessing the root collection at their various refresh times (I'm using lock(this.Graphics){} right now).

Also, regarding the issue of removing graphics, my thought was that it would be faster to remove all the graphics from a certain layer and replace them, rather than having to loop through the whole collection and compare the old and new features' attributes, geometries, icons, etc. Do you maintain that it's faster to compare? 
  Dan Walton
GIS Fire Tools
Real Time Wildfire Image Processing and Situational Awareness
http://gisfiretools.com/firehawk.web/ 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: KML support? 
Author Morten Nielsen 
Date Jan 21, 2010 
Message While you might be right that it could be faster to do that, it's not going to be an issue until long after you have so many features that rendering performance will be the bottleneck.
Basically I wouldn't worry about it.

Doing a Clear() on all graphics and re-adding them all again is definitely the slowest option. Finding an object in a collection: FAST. Rendering an object all over again: SLOOOOOOOOOW. 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: KML support? 
Author Daniel Walton 
Date Jan 21, 2010 
Message Thanks for the inputs Morten. Can I modify a graphic's attribute (e.g. "lastupdated") without causing the graphic to be refreshed?

You can check out the refresh performance on our site. The bottommost layer under 'Layers' is a flight tracker for inbound flights to LAX. It refreshes every minute, and the refresh for ~50 features (each having an icon and a polyline) takes less than a second.

One more weird issue, the plane icons are offset until the first refresh, then they look correct. What could cause this?
 
  Dan Walton
GIS Fire Tools
Real Time Wildfire Image Processing and Situational Awareness
http://gisfiretools.com/firehawk.web/ 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: KML support? 
Author Morten Nielsen 
Date Jan 21, 2010 
Message Updates to attributes does not cause a graphic to update, so yes you can. However if you are binding these attributes into the symbol, you will need to refresh that graphic manually (this is something we are looking into fixing).

Regarding offsets, make sure offsets are correctly set before adding them to the layer. There's a bug in v1.1 where changing the offsets after rendering them will not recenter the graphic (will be fixed in our next release). 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: KML support? 
Author Daniel Walton 
Date Jan 21, 2010 
Message The layer offsets are set to 0, 0. The icons position is the same as the endpoint of the purple line. It looks like the symbol template rectangle is not applying the RenderTransformOrigin of (0.5, 0.5) until the refresh. Here is the markup for a symbol: 
 
<Placemark>
<name>SKW6078</name>
<Style id='fbstyle80787715'>
<IconStyle>
<heading>0</heading>
<Icon><href>root://icons/palette-2.png</href><y>0</y><w>32</w><h>32</h></Icon
></IconStyle>
</Style>
<description>...</description>
<styleUrl>#fbstyle80787715</styleUrl>
<Point>
<extrude>1</extrude><altitudeMode>absolute</altitudeMode>
<coordinates>
-118.19,33.9655555555556,10668
</coordinates>
</Point>
</Placemark>

<Placemark><styleUrl>#fbpaths</styleUrl>
<LineString>
<tessellate>0</tessellate>
<altitudeMode>absolute</altitudeMode>
<coordinates>
-118.19,33.9655555555556,10668 ... -118.331666666667,33.9527777777778,11667
</coordinates>
</LineString>
</Placemark>
 
  Dan Walton
GIS Fire Tools
Real Time Wildfire Image Processing and Situational Awareness
http://gisfiretools.com/firehawk.web/