嗨我有1000纬度,经度,想在地图上显示所有这些。 我尝试了几种方法,但没有运气.....我有一个datagridview有client,lat,long,region。每个客户都有一个区域。当我点击组合框区域1时,我有一个组合框,它应该在地图上显示区域1上的所有客户端是否可能。请帮忙。
if (comboBox5.SelectedIndex == 0)//(REGION 1)
{
String Query = " SELECT top Latitude,Longitude FROM[ICPS].[dbo].[Sheet3_kir] ";
SqlCommand cmdDatabase = new SqlCommand(Query, conDatabase);
SqlDataReader myReader;
gMapControl1.MapProvider = GMap.NET.MapProviders.BingMapProvider.Instance;
GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerOnly;
GMapOverlay markersOverlay = new GMapOverlay("VCS MAP");
//gMapControl1.Overlays.Add(markersOverlay);
for (int i = 0; i <= dataGridView1.Rows.Count; i++)
{
foreach (DataGridViewRow row in dataGridView1.Rows)
{
var Latitude = double.Parse(dataGridView1.Columns[1].ToString());
var Longitude = double.Parse(dataGridView1.Columns[2].ToString());
gMapControl1.Position = new PointLatLng(Latitude, Longitude);
// GMarkerGoogle marker = new GMarkerGoogle(new PointLatLng(float.Parse(this.dataGridView1.Columns[1].ToString), float.Parse(this.textBox26.Text)),
// GMarkerGoogleType.green);
GMarkerGoogle m = new GMarkerGoogle(gMapControl1.Position, GMarkerGoogleType.green_pushpin);
//markersOverlay.Markers.Add(m);
}
}
答案 0 :(得分:0)
MySqlDataAdapter da = new MySqlDataAdapter("select * from sinkhole where sinkhole_status = '" + "Active" + "'", Conn);
MySqlCommandBuilder cBuilder = new MySqlCommandBuilder(da);
DataTable dataTable = new DataTable();
DataSet ds = new DataSet();
da.Fill(dataTable);
for (int i = dataTable.Rows.Count - 1; i >= 0; i--)
{
double lng = double.Parse(dataTable.Rows[i][4].ToString());
double lat = double.Parse(dataTable.Rows[i][3].ToString());
string location = dataTable.Rows[i][2].ToString();
string name = dataTable.Rows[i][1].ToString();
string desciption = dataTable.Rows[i][5].ToString();
GMapOverlay markersOverlay = new GMapOverlay(map, "marker");
GMapMarkerGoogleGreen marker = new GMapMarkerGoogleGreen(new PointLatLng(lat, lng));
markersOverlay.Markers.Add(marker);
//marker.ToolTipMode = MarkerTooltipMode.Always;
marker.ToolTip = new GMapRoundedToolTip(marker);
marker.ToolTipText = "Coordinates: (" + Convert.ToString(lat) + "," + Convert.ToString(lng) + ")" + "\nLocation: " + location + "\nName: " + name;
map.Overlays.Add(markersOverlay);