This project has moved. For the latest updates, please go here.

How to add GroundOverLay on nokia map in wp8??

Nov 13, 2013 at 10:18 AM
Edited Nov 13, 2013 at 10:19 AM
Hi samcragg,

I have some practical questions using your SharpKml because I couldn't find in in the Documentation:

-How to add groundOverLay on map using c# wp8 i wrote following code that is not working..
        GroundOverlay groundOverLay = new GroundOverlay();

        LatLonBox latLong = new LatLonBox();

        foreach (var item in groundOverlayArray)
        {
            groundOverLay.Icon = new SharpKml.Dom.Icon
            {
                Href = new Uri(item.Icon, UriKind.RelativeOrAbsolute)
            };
            url1 = item.Icon;
            latLong.East = Convert.ToDouble(item.east);
            latLong.North = Convert.ToDouble(item.north);
            latLong.South = Convert.ToDouble(item.south);
            latLong.West = Convert.ToDouble(item.west);
        }

        groundOverLay.Bounds = latLong;

        overlay = new MapOverlay();
        overlay.Content = groundOverLay;
        layer = new MapLayer();
        layer.Add(overlay);

        MyMap.Layers.Add(layer);
The groundOverlayArray data come from the KML file
Coordinator
Nov 13, 2013 at 9:19 PM
I'm not entirely sure about the map control you are using but it looks like you're creating the GroundOverlay once and changing and changing it in each iteration of the foreach loop and then only adding it once to the map layer, I'm guessing you probably want something like this structure:
        layer = new MapLayer();

        foreach (var item in groundOverlayArray)
        {
            GroundOverlay groundOverLay = new GroundOverlay();
            LatLonBox latLong = new LatLonBox();

            // As above

            groundOverLay.Bounds = latLong;
            overlay = new MapOverlay();
            overlay.Content = groundOverLay;
            layer.Add(overlay);
        }

        MyMap.Layers.Add(layer);