marker doesn't appear on the gMap

Sep 16, 2010 at 8:36 AM

Hi all
I tried to put marker on map - but it didn't appear there ((

private GMapOverlay _gMapLayerTop;

_gMapLayerTop = new GMapOverlay(gMapControl1, "top");

private void gMapControl1_MouseUp(object sender, MouseEventArgs e)
        {
            try
            {
                if(e.Button == MouseButtons.Left)
                {                    
                    var gP = gMapControl1.FromLocalToLatLng(e.X, e.Y);
                    var marker = new GMapMarkerGoogleGreen(gP);                   
                    _gMapLayerTop.Markers.Add(marker);
                    gMapControl1.CurrentPosition = gP;
                    return;
                }
            }catch(Exception ex)
            {
                log.WriteLog("Form1.gMapControl1_MouseUp", "Err:"+ex.Message);
            }
        }
 

Map centerred to click place (gP), but marker didn't appear.

I tried doing this on empty project - it worked fine,
but when I tried to do this on my work project (Sharpmap + GMap.Net) I could not draw marker on the map (((

What problem could be in this case?

--

I've just tried to debug it and saw - gMapControl1.Overlays.Count=0 after 

_gMapLayerTop = new GMapOverlay(gMapControl1, "top");

Can you suggest a reason a top layer hasn't added to layers gMapControl?
Coordinator
Sep 16, 2010 at 8:40 AM

well you have to add your layer to map, gMapControl1.Overlays.Add(gMapLayerTop);

Sep 16, 2010 at 8:42 AM

I fogot to add my layer to gMapControl1.Overlays in this project ((

gMapControl1.Overlays.Add(_gMapLayerTop);

 

Thanks, radioman )

Sep 16, 2010 at 8:45 AM

Now all works fine!

Thanks   ))

//sorry for my inattentiveness

Coordinator
Sep 16, 2010 at 8:47 AM

;}