Добавить несколько маркеров на карте в WinForms
I am trying to plot custom markers on lat-lon points read from a csv file But I am not able to get my code to work: it either adds just the first marker or the last Could you please have a look and tell me where i am getting it wrong? markers = new GMapOverlay("markers"); while ((line = sr.ReadLine()) != null) { string[] parts = line.Split(','); var p = parts; Double.TryParse(parts[3],out lat); Double.TryParse(parts[4], out lon); GMapMarker marker = new GMarkerGoogle(new PointLatLng(lat, lon), new Bitmap("..\\..\\Resources\\arp.jpg")); marker.ToolTipText = new PointLatLng(lat,lon).ToString(); marker.IsVisible = true; markers.Markers.Add(marker); navDataMap.Overlays.Add(markers); } //adds just first marker markers = new GMapOverlay("markers"); while ((line = sr.ReadLine()) != null) { string[] parts = line.Split(','); var p = parts; Double.TryParse(parts[3],out lat); Double.TryParse(parts[4], out lon); GMapMarker marker = new GMarkerGoogle(new PointLatLng(lat, lon), new Bitmap("..\\..\\Resources\\arp.jpg")); marker.ToolTipText = new PointLatLng(lat,lon).ToString(); marker.IsVisible = true; markers.Markers.Add(marker); //navDataMap.Overlays.Add(markers); } navDataMap.Overlays.Add(markers); //adds just last marker Thank you
Что я уже пробовал:
все решения stackoverflow