ThinkGeo.com    |     Documentation    |     Premium Support

Displaying kml file

Hi,
I’m trying to display kml file on map but file is not displaying.
I’ve referred this wiki site.
https://wiki.thinkgeo.com/wiki/source_code_webeditionsample_kmlextension_cs_100629.zip
Here, I’m attaching my sample code.Please have a look.
these are kml & supported files
App_Data.zip (25.7 KB)
Zip.zip (7.9 KB)

Thanks

Thanks Mouni,
We rebuild the kml layer in the mapsuite 12. It should be easier to load kml here is the sample code.

private void Window_Loaded(object sender, RoutedEventArgs e)
{

    mapView.MapUnit = GeographyUnit.DecimalDegree;

    KmlFeatureLayer layer = new KmlFeatureLayer(System.AppDomain.CurrentDomain.BaseDirectory + @"\App_Data\VMP_16_07.kml");
    string projString = System.IO.File.ReadAllText(System.AppDomain.CurrentDomain.BaseDirectory + @"\App_Data\VMP_16_07.kml.prj");
    ProjectionConverter projectionConverter = new ProjectionConverter(Projection.ConvertWktToProjString(projString), 4326);
    projectionConverter.Open();


    layer.EnableEmbeddedStyle = false;
    layer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColor.FromArgb(255, 169, 195, 221), 2F, GeoColors.Red, 4F, false);
    layer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(255, 233, 232, 214), GeoColor.FromArgb(255, 156, 155, 154), 1);
    layer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyle.CreateSimplePointStyle(PointSymbolType.Circle, GeoColors.Red, 5);
    layer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
    layer.FeatureSource.ProjectionConverter = projectionConverter;
    layer.Open();
    mapView.CurrentExtent = layer.GetBoundingBox();
    LayerOverlay layerOverlay = new LayerOverlay();
    layerOverlay.Layers.Add(layer);
    mapView.Overlays.Add(layerOverlay);
    mapView.Refresh();
}

I also attached you the full project.
KmlDemo.zip (36.2 KB)

Thanks

Frank

Thank you Frank for your reply.
The code I’ve attached is in MapSuite v7.0. & .NET framework 4.7.2. I’m not using .xml version so I’m not getting how to convert above mentioned two ProjectionConverter lines in my code.Please provide alternative solution to this as soon.