Hi I have 1000 latitudes , longitudes and want to display all of them on maps . I tried several ways to do it but not luck.....I have a datagridview which has client,lat,long,region. each client has a region.I have a combobox when I click on combobox region 1 it should display all clients on region 1 on map can it be possible. please help.
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);
}
}
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);