This project has moved and is read-only. For the latest updates, please go here.

Get Placemark color from Style

Mar 1, 2013 at 1:17 PM
I've loaded and parsed my KML file:
Kml kml = file.Root as Kml;
                if (kml != null)
                    List<Placemark> placemarks = new List<Placemark>();
                    ExtractPlacemarks(kml.Feature, placemarks);

                    foreach (Placemark placemark in file.Root.Flatten().OfType<Placemark>())
                        string roadName = placemark.Name;
But at this point I also want to extract the colour from the placemarks style, the cc1447ff value:
<Style id="DM">

Any ideas?

Mar 1, 2013 at 8:05 PM
I think the SharpKml.Engine.StyleResolver.CreateResolvedStyle() method may do what you want - it returns a Style that will be a combination of the StyleUrl and the StyleSelector of a Feature - you should be able to extract the colour information you want.

Hope it helps,