When trying to load a KML file I’m getting the exception above, stack trace below, sample attached Kml Sample.txt (72.8 KB)
at xRM=.OxY=.PhY=(String nodeLocalName)
at ThinkGeo.MapSuite.Core.KmlFile.ReadStyles()
at ThinkGeo.MapSuite.Core.KmlFile.Open()
at ThinkGeo.MapSuite.Core.KmlFeatureSource.OpenCore()
at ThinkGeo.MapSuite.Core.FeatureSource.Open()
at ThinkGeo.MapSuite.Core.FeatureLayer.OpenCore()
at ThinkGeo.MapSuite.DesktopEdition.LayerOverlay.DrawCore(GeoCanvas canvas)
at ThinkGeo.MapSuite.DesktopEdition.Overlay.sRM=(GeoCanvas canvas)
at ThinkGeo.MapSuite.DesktopEdition.Overlay.Draw(GeoCanvas canvas)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.dRQ=(IEnumerable`1 drawingOverlays, RectangleShape extent)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.dBQ=(RectangleShape drawingExtent, RectangleShape extent)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.lBQ=(RectangleShape extent)
at ShapefileToGoogleMap.KmlTestForm.OpenKml(String fileName) in C:\Users\sclark.CBO\Documents\Visual Studio 2015\Projects\ThinkGeo\Samples\ShapefileToGoogleMap\KmlTestForm.cs:line 48
at ShapefileToGoogleMap.KmlTestForm.openKmlBtn_Click(Object sender, EventArgs e) in C:\Users\sclark.CBO\Documents\Visual Studio 2015\Projects\ThinkGeo\Samples\ShapefileToGoogleMap\KmlTestForm.cs:line 64
The method is very simple at the moment, it appears it’s something within the style format that’s an issue
private void OpenKml(string fileName)
{
KmlFeatureLayer layer = new KmlFeatureLayer(fileName);
layer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
layer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = new AreaStyle(new GeoPen(GeoColor.SimpleColors.Black), new GeoSolidBrush(GeoColor.SimpleColors.Yellow));
layer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = new LineStyle(new GeoPen(GeoColor.SimpleColors.Blue, 5));
layer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = new PointStyle(PointSymbolType.Circle, new GeoSolidBrush(GeoColor.SimpleColors.Green), 10);
LayerOverlay overlay = new LayerOverlay();
string layerName = System.IO.Path.GetFileNameWithoutExtension(fileName);
overlay.Layers.Add(layerName, layer);
string overlayName = $"{layerName}-Overlay";
winformsMap1.Overlays.Add(overlayName, overlay);
winformsMap1.Refresh();
}