protected string GMap1_ServerEvent(object s, GAjaxServerEventOtherArgs e) { string js = string.Empty; switch (e.eventName) { case "Click": GLatLng latlng = new GLatLng( Convert.ToDouble(e.eventArgs[2], new System.Globalization.CultureInfo("en-US", false)), Convert.ToDouble(e.eventArgs[3], new System.Globalization.CultureInfo("en-US", false))); GInfoWindow window = new GInfoWindow(latlng, string.Format("Window Size (px): ({0},{1}). Close Me.", e.eventArgs[0], e.eventArgs[1])); GListener listener = new GListener(window.ID, GListener.Event.infowindowclose, string.Format( @" function() {{ var ev = new serverEvent('InfoWindowClose', {0}); ev.addArg('My Argument'); ev.send(); }} ", window.ID)); js = window.ToString(e.who) + listener.ToString(); break; case "InfoWindowClose": js = string.Format ("alert('{0}: {1} - {2} - {3}')", e.eventName, e.point, e.eventArgs[0], DateTime.Now); break; } return js; }
private void arreglarMapa() { GMap1.Add(new GControl(GControl.preBuilt.LargeMapControl)); GMap1.enableHookMouseWheelToZoom = true; StringBuilder sb = new StringBuilder(); sb.Append("function(marker, point) {"); GLatLng latlng = new GLatLng("point"); GInfoWindow window = new GInfoWindow(latlng, "<div style=\"height:140px;\"><blink>Loading...</blink></div>"); sb.Append(window.ToString(GMap1.GMap_Id)); sb.Append("}"); GMap1.Add(new GListener(GMap1.GMap_Id, GListener.Event.click, sb.ToString())); StringBuilder sb2 = new StringBuilder(); sb2.Append("function goTo(point){"); GLatLng point = new GLatLng("point"); sb2.AppendFormat("{0}.setZoom(11);", GMap1.GMap_Id); GMove move = new GMove(1, point); sb2.Append(move.ToString(GMap1.GMap_Id)); GMarker marker = new GMarker(point); sb2.Append(marker.ToString(GMap1.GMap_Id)); sb2.Append("}"); GMap1.Add(sb2.ToString()); }
protected void Submit_Click(object sender, EventArgs e) { locator.locate find = new locator.locate(); string q = txtblood.Text; string r = txtZip.Text; string ab = find.locate0(r, q); string bc = find.locate1(r, q); string cd = find.locate2(r, q); string de = find.counting(r, q); Label1.Text = de; string address = ab + "," + bc + "," + cd + "," + r; string latitude1 = ""; string longitude1 = ""; // Response.Redirect("http://where.yahooapis.com/geocode?location=" +address ); XmlTextReader xtr = new XmlTextReader("http://where.yahooapis.com/geocode?location=" + address); xtr.WhitespaceHandling = WhitespaceHandling.Significant; //Response.Write(xtr.ToString()); try { while (xtr.Read()) { if (xtr.Name.ToString() == "latitude") { latitude1 = xtr.ReadString().ToString(); } if (xtr.Name.ToString() == "longitude") { longitude1 = xtr.ReadString().ToString(); } } GMap2.addGMapUI(new GMapUI()); GMapUIOptions options = new GMapUIOptions(); GLatLng latlong = new GLatLng(double.Parse(latitude1), double.Parse(longitude1)); GMapType.GTypes maptype = GMapType.GTypes.Normal; GMap2.setCenter(latlong, 15, maptype); //GMap2.GZoom = 9; PinLetter pinLetter = new PinLetter("o", Color.Red, Color.Black); GMap2.addGMarker(new GMarker(latlong, new GMarkerOptions(new GIcon(pinLetter.ToString(), pinLetter.Shadow())))); GMarker marker = new GMarker(latlong); GInfoWindowOptions IWoptions = new GInfoWindowOptions(12, maptype); GInfoWindow mbUp = new GInfoWindow(marker, address, IWoptions); GMap2.addInfoWindow(mbUp); } catch (Exception) { Response.Write("invalid adress"); } }
protected void Page_Load(object sender, EventArgs e) { GLatLng latlng = new GLatLng(42.12, -1.145); GMap1.setCenter(latlng, 5, GMapType.GTypes.Hybrid); GMarker marker = new GMarker(latlng); GInfoWindowOptions windowOptions = new GInfoWindowOptions(12, GMapType.GTypes.Normal); //GShowMapBlowUp mbUp = new GShowMapBlowUp(marker, false, IWoptions); //GMap1.addShowMapBlowUp(mbUp); GInfoWindow mbUp = new GInfoWindow(marker, "I'm an infoWindow", windowOptions); GMap1.Add(mbUp); GMap1.Add(new GMarker(latlng + new GLatLng(2, 1))); GMarkerOptions markerOptions = new GMarkerOptions(); markerOptions.clickable = false; GMarker marker2 = new GMarker(latlng + new GLatLng(-1, 2.5), markerOptions); GMap1.Add(marker2); GMarker markerDraggable = new GMarker(latlng + new GLatLng(-2, -1)); GMarkerOptions mOpts = new GMarkerOptions(); mOpts.draggable = true; markerDraggable.options = mOpts; // string jsStart = "function() {" + GMap1.GMap_Id + ".closeInfoWindow();}"; // string jsEnd = "function() {" + markerDraggable.ID + ".openInfoWindowHtml('<a href=\"http://www.playsudoku.biz\" target=\"_blank\">Play Sudoku</a>');}"; string jsStart = "function() { if (typeof variable !== myInfoWindow) {myInfoWindow.close(); } }"; string jsEnd = "function() { myInfoWindow = new google.maps.InfoWindow({ content: '<a href=\"http://www.playsudoku.biz\" target=\"_blank\">Play Sudoku</a>' }); myInfoWindow.open(" + GMap1.GMap_Id + "," + markerDraggable.ID + "); }"; GMap1.Add(new GListener(markerDraggable.ID, GListener.Event.dragstart, jsStart)); GMap1.Add(new GListener(markerDraggable.ID, GListener.Event.dragend, jsEnd)); GMap1.Add(markerDraggable); }
protected void Button1_Click(object sender, EventArgs e) { us = (User)Session["user"]; string lat = (string)Session["lat"]; string lon = (string)Session["long"]; GLatLng mainarea = new GLatLng(33.50, 36.30); GMap1.setCenter(mainarea, 13); XPinLetter xpinletter = new XPinLetter((PinShapes.pin_star), "W", Color.Blue, Color.White, Color.Chocolate); GMap1.Add(new GMarker(mainarea, new GIcon(xpinletter.ToString(), xpinletter.Shadow()))); PinIcon p; GMarker gm; GInfoWindow gin; foreach (var i in data.Word_searches) { if (i.Word_search1.ToString().Trim() == TextBox1.Text) { p = new PinIcon(PinIcons.computer, Color.Cyan); gm = new GMarker(new GLatLng(Convert.ToDouble(i.latid), (Convert.ToDouble(i.@long))), new GMarkerOptions(new GIcon(p.ToString(), p.Shadow()))); us = data.Users.Where(pm => pm.ID == i.Searcher_id).Single(); gin = new GInfoWindow(gm, "<font color=black><b>Search info</b><br/> User:"******"<br /> Word search:" + i.Word_search1 + "<br /> date_of_search:" + i.date_s, false, GListener.Event.mouseover); GMap1.Add(gin); } } Session["lat"] = this.Request.QueryString["lat"]; Session["lon"] = this.Request.QueryString["long"]; Session["user"] = us; }
protected void control(object sender, GridViewCommandEventArgs e) { PROJEEntities db = new PROJEEntities(); if (e.CommandName == "cmd1") { int count = Convert.ToInt32(e.CommandArgument); count++; var query = (from a in db.mekans where a.id == count select a.location).SingleOrDefault(); var y = Convert.ToDouble(query.Latitude); var x = Convert.ToDouble(query.Longitude); GMap1.Height = 1000; GMap1.Width = 1000; //500'dü ben 1000 yaptım GMap1.Key = "AIzaSyBbzayQWkhyVj3CTlFAh0UoVTt6NcZTpmo"; var latlon = new GLatLng(x, y); //istenilen enlem boylam değerlerini merkez olarak alır GMap1.setCenter(latlon, 12); GMarker gm; GMarker icono = new GMarker(latlon); PinIcon p; p = new PinIcon(PinIcons.flag, Color.Red); //istenen yere bırakılacak bayrak işaretçisi gm = new GMarker(new GLatLng(Convert.ToDouble(x), Convert.ToDouble(y)), //parantezdeki sayılar enlem boylam buraya işaretçi bırakılacak new GMarkerOptions(new GIcon(p.ToString(), p.Shadow()))); GInfoWindow win; win = new GInfoWindow(gm, "" + "", false, GListener.Event.mouseover); //haritaya eklenir GMap1.addInfoWindow(win); } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["article"] == null) { Response.Redirect("UI_HomePage.aspx"); } try { string qr = "select * from Article, Category where Article.IDCategory =Category.IDCategory and Article.IDArticle = '" + Request.QueryString["article"] + "'"; object tb = cnDb.xlDataDSet(qr); dtlDetail.DataSource = tb; dtlDetail.DataBind(); lbSource.Text = cnDb.getOneData("select Source from Article where IDArticle = '" + Request.QueryString["article"] + "' ").ToString(); }catch (Exception) { Response.Redirect("UI_HomePage.aspx"); } try { //Map GMap1.addControl(new GControl(GControl.preBuilt.GOverviewMapControl)); GMap1.addControl(new GControl(GControl.preBuilt.LargeMapControl)); string toaDo = cnDb.getOneData("select MapAdd from Article where IDArticle = '" + Request.QueryString["article"] + "' ").ToString(); toaDo = toaDo.Trim(); string[] kinhViDo = Regex.Split(toaDo, ","); double kinhDo = double.Parse(kinhViDo[0], System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture); double viDo = double.Parse(kinhViDo[1], System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture); GMarker marker = new GMarker(new GLatLng(kinhDo, viDo)); GInfoWindow window = new GInfoWindow(marker, "<center><b>Điểm đến</b></center>", true); GMap1.addInfoWindow(window); }catch (Exception) { // Tọa độ sai GMap1.Visible = false; } }
protected string GMap1_ServerEvent(object s, GAjaxServerEventOtherArgs e) { string js = string.Empty; switch (e.eventName) { case "Click": GLatLng latlng = new GLatLng( Convert.ToDouble(e.eventArgs[2], new System.Globalization.CultureInfo("en-US", false)), Convert.ToDouble(e.eventArgs[3], new System.Globalization.CultureInfo("en-US", false))); GInfoWindow window = new GInfoWindow(latlng, string.Format("Window Size (px): ({0},{1}). Close Me.", e.eventArgs[0], e.eventArgs[1])); GListener listener = new GListener(window.ID, GListener.Event.infowindowclose, string.Format( @" function() {{ var ev = new serverEvent('InfoWindowClose', {0}); ev.addArg('My Argument'); ev.send(); }} ", window.ID)); js = window.ToString(e.who) + listener.ToString(); break; case "InfoWindowClose": js = string.Format ("alert('{0}: {1} - {2} - {3}')", e.eventName, e.point, e.eventArgs[0], DateTime.Now); break; } return(js); }
private void LoadGMap(string latitude, string longitude, string companyName, string address, string imageName) { PinIcon p; GMarker gm; GInfoWindow win; GLatLng mainLocation = new GLatLng(DBConvert.ParseDouble(latitude), DBConvert.ParseDouble(longitude)); GMapType.GTypes maptype = GMapType.GTypes.Normal; GMap1.setCenter(mainLocation, 15, maptype); GMap1.enableHookMouseWheelToZoom = true; GMapUIOptions options = new GMapUIOptions(); options.maptypes_hybrid = true; options.maptypes_normal = true; options.zoom_scrollwheel = true; GMap1.Add(new GMapUI(options)); //GMarker marker = new GMarker(mainLocation); GIcon icon = new GIcon(); icon.markerIconOptions = new MarkerIconOptions(50, 50, Color.Blue); p = new PinIcon(PinIcons.home, Color.Cyan); gm = new GMarker(mainLocation, new GMarkerOptions(new GIcon(p.ToString(), p.Shadow()))); win = new GInfoWindow(gm, HtmlIconMap(imageName, companyName, address), false, GListener.Event.mouseover); GMap1.addControl(new GControl(GControl.preBuilt.GOverviewMapControl)); GMap1.addControl(new GControl(GControl.preBuilt.LargeMapControl)); GMap1.Add(win); }
protected void Page_Load(object sender, EventArgs e) { GLatLng latlon = new GLatLng(10.2, 22); GMap1.setCenter(latlon, 4); GMarker icono = new GMarker(latlon); GInfoWindow window = new GInfoWindow(icono, "Ejemplo de <b>infoWindow</b>", false, GListener.Event.mouseover); GMap1.Add(window); GPolygon polygon = new GPolygon(); polygon.points.Add(new GLatLng(9, 25)); polygon.points.Add(new GLatLng(3, 22)); polygon.points.Add(new GLatLng(1, 26)); polygon.close(); GPolyline polyline = new GPolyline(polygon); GInfoWindow window2 = new GInfoWindow(); //window2.gPolygon = polygon; //window2.html = "GPolygon"; window2.gPolyline = polyline; window2.html = "polyline"; window2.opened = true; window2.sourceEvent = GListener.Event.click; GMap1.Add(window2); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // Here I used Degha Location as Main Location and Lat Long is : 21.622564, 87.523417 GLatLng mainLocation = new GLatLng(21.622564, 87.523417); GMap1.setCenter(mainLocation, 15); XPinLetter xpinLetter = new XPinLetter(PinShapes.pin_star, "H", Color.Blue, Color.White, Color.Chocolate); GMap1.Add(new GMarker(mainLocation, new GMarkerOptions(new GIcon(xpinLetter.ToString(), xpinLetter.Shadow())))); List <HotelMaster> hotels = new List <HotelMaster>(); using (MyDatabaseEntities dc = new MyDatabaseEntities()) { hotels = dc.HotelMasters.Where(a => a.HotelArea.Equals("Digha")).ToList(); } PinIcon p; GMarker gm; GInfoWindow win; foreach (var i in hotels) { p = new PinIcon(PinIcons.home, Color.Cyan); gm = new GMarker(new GLatLng(Convert.ToDouble(i.LocLat), Convert.ToDouble(i.LocLong)), new GMarkerOptions(new GIcon(p.ToString(), p.Shadow()))); win = new GInfoWindow(gm, i.HotelName + " <a href='" + i.ReadMoreUrl + "'>Read more...</a>", false, GListener.Event.mouseover); GMap1.Add(win); } } }
protected void GridView2_SelectedIndexChanging(object sender, GridViewSelectEventArgs e) { //string ah = GridView2.SelectedRow.Cells[1].Text; int I = e.NewSelectedIndex; // GridViewRow row = GridView2.SelectedRow; // string lo = row.ID; string pid = GridView2.Rows[I].Cells[1].Text; dataDataContext dd = new dataDataContext(); Word_search word = new Word_search(); var eddd = (from a in dd.Word_searches where a.ID == Convert.ToInt32(pid) select a).SingleOrDefault(); GMap1.Visible = true; GMap1.reset(); PinIcon p; GMarker gm; GInfoWindow gin; GLatLng mainarea = new GLatLng(Convert.ToDouble(eddd.latid), Convert.ToDouble(eddd.@long)); GMap1.setCenter(mainarea, 15); XPinLetter xpinletter = new XPinLetter((PinShapes.pin_star), "W", Color.Blue, Color.White, Color.Chocolate); GMap1.Add(new GMarker(mainarea, new GIcon(xpinletter.ToString(), xpinletter.Shadow()))); p = new PinIcon(PinIcons.computer, Color.Cyan); gm = new GMarker(new GLatLng(Convert.ToDouble(eddd.latid), (Convert.ToDouble(eddd.@long))), new GMarkerOptions(new GIcon(p.ToString(), p.Shadow()))); gin = new GInfoWindow(gm, "<font color=black><b>Search info</b><br/> Word search:" + eddd.Word_search1 + "<br /> date_of_search:" + eddd.date_s, false, GListener.Event.mouseover); GMap1.Add(gin); Session["lat"] = this.Request.QueryString["lat"]; Session["lon"] = this.Request.QueryString["long"]; Session["user"] = us; }
protected void Page_Load(object sender, EventArgs e) { if(!IsPostBack) { GLatLng mainLocation = new GLatLng(34.0477964, -118.2581307); GMap1.setCenter(mainLocation, 14); XPinLetter xpinLetter = new XPinLetter(PinShapes.pin_star, "H", Color.Blue, Color.White, Color.Chocolate); GMap1.Add(new GMarker(mainLocation, new GMarkerOptions(new GIcon(xpinLetter.ToString(), xpinLetter.Shadow())))); List<HotelMaster> hotels = new List<HotelMaster>(); using (HotelDatabaseEntities dc = new HotelDatabaseEntities()) { hotels = dc.HotelMasters.Where(a => a.HotelArea.Equals("Los Angeles Downtown")).ToList(); } PinIcon p; GMarker gm; GInfoWindow win; foreach(var i in hotels) { p = new PinIcon(PinIcons.home, Color.Cyan); gm = new GMarker(new GLatLng(Convert.ToDouble(i.LocLat), Convert.ToDouble(i.LocLong)), new GMarkerOptions(new GIcon(p.ToString(), p.Shadow()))); win = new GInfoWindow(gm, i.HotelName + "<a href='"+i.ReadMoreUrl+"'> Read more...</a>", false, GListener.Event.mouseover); GMap1.Add(win); } } }
protected string GMap1_DragEnd(object s, GAjaxServerEventArgs e) { GMarker marker = new GMarker(e.point); GInfoWindow window = new GInfoWindow(marker, "DragEnd - " + DateTime.Now.ToString(), false); return(window.ToString(e.map)); }
protected string GMap1_Click(object s, Subgurim.Controles.GAjaxServerEventArgs e) { GMap gmap = new GMap(e.map); // GMarker and GInfoWindow GMarker marker = new GMarker(e.point); GInfoWindow window = new GInfoWindow(marker, "Cool!!", true); gmap.Add(window); // Movement //gmap.addMovement(1000, e.point + new GLatLng(25, 38)); //gmap.addMovement(1000, e.point); // Polylines if (e.point != e.center) { List <GLatLng> points = new List <GLatLng>(); points.Add(e.center); points.Add(e.point); gmap.Add(new GPolyline(points, Color.Yellow)); } // Controls gmap.Add(new GControl(GControl.extraBuilt.MarkCenter)); gmap.Add(new GControl(GControl.preBuilt.LargeMapControl)); gmap.Add(new GControl(GControl.preBuilt.MapTypeControl)); // Maybe... anything? ;) gmap.enableHookMouseWheelToZoom = false; gmap.mapType = GMapType.GTypes.Satellite; return(gmap.ToString()); }
protected void Page_Load(object sender, EventArgs e) { GLatLng latLng = new GLatLng(50, 10); GMap1.setCenter(latLng, 4); GIcon icon = new GIcon(); icon.markerIconOptions = new MarkerIconOptions(50, 50, Color.Blue); GMarker marker = new GMarker(latLng, icon); GInfoWindow window = new GInfoWindow(marker, "You can use the Map Icon Maker as any other marker"); GMap1.Add(window); GIcon icon2 = new GIcon(); icon2.labeledMarkerIconOptions = new LabeledMarkerIconOptions(Color.Gold, Color.White, "A", Color.Green); GMarker marker2 = new GMarker(latLng + new GLatLng(3, 3), icon2); GInfoWindow window2 = new GInfoWindow(marker2, "You can use the Map Icon Maker as any other marker"); GMap1.Add(window2); GIcon icon3 = new GIcon(); icon3.flatIconOptions = new FlatIconOptions(25, 25, Color.Red, Color.Black, "B", Color.White, 15, FlatIconOptions.flatIconShapeEnum.roundedrect); GMarker marker3 = new GMarker(latLng + new GLatLng(-3, -3), icon3); GInfoWindow window3 = new GInfoWindow(marker3, "You can use the Map Icon Maker as any other marker"); GMap1.Add(window3); }
protected string GMap1_Click(object s, Subgurim.Controles.GAjaxServerEventArgs e) { GMap gmap = new GMap(e.map); // GMarker and GInfoWindow GMarker marker = new GMarker(e.point); GInfoWindow window = new GInfoWindow(marker, "Cool!!", true); gmap.Add(window); // Movement //gmap.addMovement(1000, e.point + new GLatLng(25, 38)); //gmap.addMovement(1000, e.point); // Polylines if (e.point != e.center) { List<GLatLng> points = new List<GLatLng>(); points.Add(e.center); points.Add(e.point); gmap.Add(new GPolyline(points, Color.Yellow)); } // Controls gmap.Add(new GControl(GControl.extraBuilt.MarkCenter)); gmap.Add(new GControl(GControl.preBuilt.LargeMapControl)); gmap.Add(new GControl(GControl.preBuilt.MapTypeControl)); // Maybe... anything? ;) gmap.enableHookMouseWheelToZoom = false; gmap.mapType = GMapType.GTypes.Satellite; return gmap.ToString(); }
public void mapa(double lat, double lon, string _nombres, int _items_entregados, int _entregas) { GLatLng ubicacion = new GLatLng(lat, lon); GMap.setCenter(ubicacion, 15); //Establecemos alto y ancho en px GMap.Height = 600; GMap.Width = 940; //Adiciona el control de la parte izq superior (moverse, ampliar y reducir) GMap.Add(new GControl(GControl.preBuilt.LargeMapControl)); //GControl.preBuilt.MapTypeControl: permite elegir un tipo de mapa y otro. GMap.Add(new GControl(GControl.preBuilt.MapTypeControl)); //Con esto podemos definir el icono que se mostrara en la ubicacion //#region Crear Icono GIcon iconPropio = new GIcon(); iconPropio.image = "../Images/marcadornestle1.png"; iconPropio.shadow = "../Images/marcadorsombranestle1.png";; iconPropio.iconSize = new GSize(32, 32); iconPropio.shadowSize = new GSize(29, 16); iconPropio.iconAnchor = new GPoint(10, 18); iconPropio.infoWindowAnchor = new GPoint(10, 9); //#endregion //Pone la marca de gota de agua con el nombre de la ubicacion GMarker marker = new GMarker(ubicacion, iconPropio); string strMarker = "<div style='width: 200px; border-radius: 35px; ; height: 150px'><b>" + "<span style='color:#ff7e00'>Establecimiento: </span>" + _nombres + "</b><br>" + " Items Entregados: " + _items_entregados + " <br /> Cantidad de Entregas: " + _entregas + "<br />" + "" + "<br /><br><br></div>"; /*string strMarker = "<div style='width: 250px; height: 185px'><b>" + * "<span style='color:#ff7e00'>es</span>ASP.NET</b><br>" + * " C/ C/ Nombre de Calle, No X <br /> 28031 Madrid, España <br />" + * "Tel: +34 902 00 00 00 <br />Fax: +34 91 000 00 00<br />" + * "Web: <a href='http://www.esASP.net/' class='txtBKM' >www.esASP.net</a>" + * "<br />Email: <a href='mailto:[email protected]' class='txtBKM'>" + * "[email protected]</a><br><br></div>"; */ GInfoWindow window = new GInfoWindow(marker, strMarker, false, GListener.Event.mouseover); GMap.Add(window); GMap.enableHookMouseWheelToZoom = true; //Tipo de mapa a mostrar //GMap.mapType = GMapType.GTypes.Normal; GMapType.GTypes maptype = GMapType.GTypes.Normal; GLatLng latlong = new GLatLng(-0.185631, -78.484490); GMap.setCenter(latlong, 12, maptype); //Moverse con el cursor del teclado GMap.enableGKeyboardHandler = true; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["province"] != null && Request.QueryString["city"] != null) { Bll.SupplierBll sb = new Bll.SupplierBll(); DataTable dt = sb.GetAny("select * from tab_suppliers where province like N'" + Request.QueryString["province"] + "' and city like N'" + Request.QueryString["city"] + "'"); GMap1.Add(new GControl(GControl.preBuilt.GOverviewMapControl)); GMap1.Add(new GControl(GControl.preBuilt.LargeMapControl)); GMarker marker; GInfoWindow window; double lat, lng, clat = 0.0, clng = 0.0; foreach (DataRow dr in dt.Rows) { lat = Convert.ToDouble(dr["lat"]); lng = Convert.ToDouble(dr["lng"]); clat += lat; clng += lng; marker = new GMarker(new GLatLng(lat, lng)); window = new GInfoWindow(marker, "<center><b>" + dr["supplier"].ToString() + "</b><br />" + dr["branch"].ToString() + "</center>", false); GMap1.Add(window); } clat /= dt.Rows.Count; clng /= dt.Rows.Count; GMap1.enableHookMouseWheelToZoom = true; GMap1.setCenter(new GLatLng(clat, clng), 12); } } }
private void FillHome() { GLatLng gLatLng = null; if (Lat.HasValue) { gLatLng = new GLatLng(Lat.Value, Lon.Value); } else if (Address != null) { GeoCode geoCode = GMap1.getGeoCodeRequest(Address); if (geoCode.valid) { gLatLng = geoCode.Placemark.coordinates; } } if (gLatLng != null) { PinIcon pinIcon = new PinIcon(PinIcons.home, Color.FromArgb(0xB4, 0x97, 0x59)); var markerOptions = new GMarkerOptions(new GIcon(pinIcon.ToString(), pinIcon.Shadow()), Title.Replace("'", "´")); GMarker marker = new GMarker(gLatLng, markerOptions); //GMarker marker = new GMarker(gLatLng); StringBuilder sb = new StringBuilder(); sb.Append(Title); GInfoWindow window = new GInfoWindow(marker, sb.ToString(), false); GMap1.addInfoWindow(window); GMap1.setCenter(new GLatLng(gLatLng.lat, gLatLng.lng), InitialZoom); } }
protected string GMap1_ServerEvent(object s, GAjaxServerEventOtherArgs e) { string js = string.Empty; switch (e.eventName) { case "Click": GLatLng latlng = new GLatLng( Convert.ToDouble(e.eventArgs[2], new System.Globalization.CultureInfo("en-US", false)), Convert.ToDouble(e.eventArgs[3], new System.Globalization.CultureInfo("en-US", false))); GInfoWindowOptions options = new GInfoWindowOptions(); options.onCloseFn = string.Format(@" function() {{ var ev = new serverEvent('InfoWindowClose', {0}); ev.addArg('My Argument'); ev.send(); }} ", GMap1.GMap_Id); GInfoWindow window = new GInfoWindow(latlng, string.Format("Window Size (px): ({0},{1}). Close Me.", e.eventArgs[0], e.eventArgs[1]), options); //guardar punto Session["lat"] = latlng.lat.ToString(); Session["lng"] = latlng.lng.ToString(); js = window.ToString(e.who); break; } return(js); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // Here I used Degha Location as Main Location and Lat Long is : 21.622564, 87.523417 GLatLng mainLocation = new GLatLng(40.813445, 29.307283); GMap1.setCenter(mainLocation, 15); XPinLetter xpinLetter = new XPinLetter(PinShapes.pin_star, "H", Color.Blue, Color.White, Color.Chocolate); GMap1.Add(new GMarker(mainLocation, new GMarkerOptions(new GIcon(xpinLetter.ToString(), xpinLetter.Shadow())))); List <lokasyon> lokasyonlar = new List <lokasyon>(); using (lokasyonContext dc = new lokasyonContext()) { lokasyonlar = dc.lokasyonlar.ToList(); //lokasyonlar = dc.HotelMasters.Where(a => a.HotelArea.Equals("Digha")).ToList(); } PinIcon p; GMarker gm; GInfoWindow win; foreach (var i in lokasyonlar) { p = new PinIcon(PinIcons.home, Color.Cyan); gm = new GMarker(new GLatLng(Convert.ToDouble(i.enlem), Convert.ToDouble(i.boylam)), new GMarkerOptions(new GIcon(p.ToString(), p.Shadow()))); win = new GInfoWindow(gm, i.mekan_ismi + " <a href='" + i.siteye_git + "'>Read more...</a>", false, GListener.Event.mouseover); GMap1.Add(win); } } }
protected void Page_Load(object sender, EventArgs e) { //if (!IsPostBack) //{ navigatorView = new NavigatorView(); var center = new GLatLng(48.51, 10.21); Gmap1.setCenter(center, 4); var xpinLetter = new XPinLetter(PinShapes.pin_star, "C", Color.Blue, Color.White, Color.Chocolate); var location = new GLatLng(center.lat, center.lng); //Gmap1.Add(new GMarker(location, new GMarkerOptions(new GIcon(xpinLetter.ToString(), xpinLetter.Shadow())))); foreach (var marker in navigatorView.ListMarker) { if (marker.Latitude > -90 && marker.Latitude < 90) { var icon = new PinIcon(PinIcons.flag, Color.Coral); var gMarker = new GMarker(new GLatLng(marker.Latitude, marker.Longitude), new GMarkerOptions(new GIcon(icon.ToString(), icon.Shadow()))); var tableText = String.Format(Marker.infoTableHtml, marker.Name, marker.Name, marker.Name, marker.Latitude, marker.Longitude); var infoWindow = new GInfoWindow(gMarker, tableText, false, GListener.Event.click); Gmap1.Add(infoWindow); } } //} }
public void ShowMap(List <Restaurant> list, string val) { PinIcon p; GMarker gm; GInfoWindow win; GMap1.resetInfoWindows(); foreach (var i in list) { p = new PinIcon(PinIcons.home, Color.Cyan); gm = new GMarker(new GLatLng(Convert.ToDouble(i.Latitude), Convert.ToDouble(i.Longitude)), new GMarkerOptions(new GIcon(p.ToString(), p.Shadow()))); //win = new GInfoWindow(gm, i.Name + " </br>Specialty: " + i.Specialty + " </br>" + " <a href='" + i.Url + "'>Read more...</a>", false, GListener.Event.mouseover); win = new GInfoWindow(gm, i.Name + " </br>Specialty: " + i.Specialty + " </br>" + " <a href='' id='myid' runat='server' OnClick='ShowDirections(" + i.Latitude + ", " + i.Longitude + ")'>Get Directions </a> ", false, GListener.Event.mouseover); GMap1.Add(win); string items = i.Specialty.ToString(); if (val == "") { ddlType.Items.Add(items); } ddlType.Items.FindByValue(val).Attributes.Add("Selected", "Selected"); ddlType.Items.FindByValue("").Attributes.Remove("Text"); ddlType.Items.FindByValue("").Attributes.Add("Text", "Select ALL"); } }
protected void Page_Load(object sender, EventArgs e) { GLatLng latlon = new GLatLng(10.2, 22); GMap1.setCenter(latlon, 4); GInfoWindow window = new GInfoWindow(latlon, "Ejemplo de <b>infoWindow</b>"); GMap1.Add(window); }
protected void MuestraUbicacionEnMapa(Double latitud, double longitud, string mensajeVentana, int zoom) { MapaPrueba.setCenter(new GLatLng(latitud, longitud), zoom, TipoMapa); Marcador = new GMarker(new GLatLng(latitud, longitud)); Marcador.options = MarketOPciones; Session["Marcador"] = Marcador; ventana = new GInfoWindow(Marcador, mensajeVentana, true); MapaPrueba.Add(ventana); }
protected string GMap1_Click(object s, GAjaxServerEventArgs e) { GMap1.GZoom = 1; GInfoWindow window = new GInfoWindow(e.point, "Clicked"); GMap1.Add(window); return string.Empty; }
protected void Page_Load(object sender, EventArgs e) { dt.Columns.Add("Tweet"); dt.Columns.Add("User"); dt.Columns.Add("Location"); dt.Columns.Add("Longitude"); dt.Columns.Add("latitude"); dt.Columns.Add("TweetCount"); tokens.AccessToken = "140219230-Mww3rqC22jsEeGrwyWzfgGtzXNlPonroTyyFaE6F"; tokens.AccessTokenSecret = "fNao9nGu9fgmxYtcF0UXoVMCcAGoBzkRPRfl7ujA2il1b"; tokens.ConsumerKey = "2VqPg2xyY8A7ziLmRk5SaRaSL"; tokens.ConsumerSecret = "ccJGxDaBDgyvrn6UGQFmQd0RNLXn3qRcTbg8rKZo01bmrK0EH5"; TwitterResponse<TwitterSearchResultCollection> result = TwitterSearch.Search(tokens, "#ACME", new SearchOptions()); TwitterSearchResultCollection results = result.ResponseObject; List<TwitterSearchResult> resultList = results.ToList(); foreach (var item in resultList) { string longtu = ""; string lattu = ""; try { longtu = item.Geo.Coordinates[0].Longitude.ToString(); lattu = item.Geo.Coordinates[0].Latitude.ToString(); } catch (Exception) { } if (longtu != "" && lattu != "") { GLatLng mainLocation = new GLatLng(Convert.ToDouble(longtu), Convert.ToDouble(lattu)); GMap1.setCenter(mainLocation, 5); PinIcon p; GMarker gm; GInfoWindow win; p = new PinIcon(PinIcons.home, Color.Cyan); gm = new GMarker(new GLatLng(Convert.ToDouble(longtu), Convert.ToDouble(lattu)), new GMarkerOptions(new GIcon(p.ToString(), p.Shadow()))); win = new GInfoWindow(gm, "" + "", false, GListener.Event.mouseover); GMap1.Add(win); } dt.Rows.Add(item.Text, item.User.Name, item.User.Location,longtu , lattu,item.User.ListedCount); } GridView1.DataSource = dt; GridView1.DataBind(); }
protected string GMap1_Click(object s, GAjaxServerEventArgs e) { GMap1.GZoom = 1; GInfoWindow window = new GInfoWindow(e.point, "Clicked"); GMap1.Add(window); return(string.Empty); }
protected void Page_Load(object sender, EventArgs e) { GMap1.addControl(new GControl(GControl.preBuilt.GOverviewMapControl)); GMap1.addControl(new GControl(GControl.preBuilt.LargeMapControl)); GMarker marker = new GMarker(new GLatLng(39.5, -3.2)); GInfoWindow window = new GInfoWindow(marker, "<center><b>GoogleMaps.Subgurim.NET</b></center>", true); GMap1.addInfoWindow(window); }
protected void cmdMapa_Click(object sender, EventArgs e) { // GMap1.resetMarkers(); //string fulladdress = string.Format("{0}.{1}.{2}.{3}", ddlCalle.SelectedItem.Text, ddlMunicipio.SelectedItem.Text, "TAMAULIPAS", "MEXICO"); ////string skey = ConfigurationManager.AppSettings["googlemaps.subgurim.net"]; //GeoCode geocode; //geocode = GMap1.getGeoCodeRequest(fulladdress); //var glatlng = new Subgurim.Controles.GLatLng(geocode.Placemark.coordinates.lat, geocode.Placemark.coordinates.lng); //GMap1.setCenter(glatlng, 16, Subgurim.Controles.GMapType.GTypes.Normal); //var oMarker = new Subgurim.Controles.GMarker(glatlng); //GMap1.Add(oMarker); // SqlDataAdapter daHechos = new SqlDataAdapter("select ID_CARPETA, LATITUD, LONGITUD from PGJ_LUGAR_HECHOS where year(FECHA_HECHOS)=2014", Data.CnnCentral); SqlDataAdapter daHechos = new SqlDataAdapter("select p.ID_CARPETA,SUBSTRING(pc.NUC,11,10) as NUC,SUBSTRING(pc.RAC,11,10) AS RAC,cu.UNDD_DSCRPCION, p.LATITUD as LATITUD, p.LONGITUD as LONGITUD from PGJ_LUGAR_HECHOS p inner join PGJ_DELITOS pd on pd.ID_LUGAR_HECHOS=p.ID_LUGAR_HECHOS INNER JOIN PGJ_CARPETA pc on pc.ID_CARPETA=p.ID_CARPETA INNER JOIN CAT_UNIDAD cu on cu.ID_UNDD=SUBSTRING(pc.rac,7,3) or cu.ID_UNDD=SUBSTRING(pc.nuc,7,3) where year(FECHA_HECHOS)=" + txtAño.Text + "and pd.id_delito=" + short.Parse(ddlDelito.SelectedValue.ToString()), Data.CnnCentral); DataSet dsHechos = new DataSet(); daHechos.Fill(dsHechos, "Hechos"); foreach (DataRow drHechos in dsHechos.Tables["Hechos"].Rows) { if ((drHechos["LATITUD"].ToString() != "") && (drHechos["LONGITUD"].ToString() != "") && (drHechos["ID_CARPETA"].ToString() != "")) { double Longitud; Longitud = double.Parse(drHechos["LONGITUD"].ToString()); if (Longitud > 0) { Longitud = Longitud * -1; } ////var glatlng = new Subgurim.Controles.GLatLng(Convert.ToDouble(drHechos["LATITUD"].ToString()), Convert.ToDouble(drHechos["LONGITUD"].ToString())); //var glatlng = new Subgurim.Controles.GLatLng(double.Parse(drHechos["LATITUD"].ToString()), double.Parse(drHechos["LONGITUD"].ToString())); var glatlng = new Subgurim.Controles.GLatLng(double.Parse(drHechos["LATITUD"].ToString()), Longitud); GMap1.setCenter(glatlng, 16, Subgurim.Controles.GMapType.GTypes.Normal); var oMarker = new Subgurim.Controles.GMarker(glatlng); // GInfoWindow window = new GInfoWindow(oMarker, drHechos["ID_CARPETA"].ToString(), false, GListener.Event.mouseover); GInfoWindow window = new GInfoWindow(oMarker, ("NUC=( " + drHechos["NUC"].ToString() + " )") + " ," + ("RAC=(" + drHechos["RAC"].ToString() + " )") + " " + (drHechos["UNDD_DSCRPCION"].ToString()), false, GListener.Event.mouseover); GMap1.Add(window); //GInfoWindowOptions options = new GInfoWindowOptions("Max Title", "Max Content"); //GInfoWindow window2 = new GInfoWindow(oMarker, ("NUC=( " + drHechos["NUC"].ToString() + " )") + " ," + ("RAC=(" + drHechos["RAC"].ToString() + " )") + " " + (drHechos["UNDD_DSCRPCION"].ToString()), options); // GMap1.Add(window2); GMap1.Add(oMarker); } } daHechos.Dispose(); dsHechos.Dispose(); GMap1.setCenter(new GLatLng(23.736819471992295, -99.14335536956787), 13); }
private void CargarMapa(string region, string provincia, string comuna, string direccion, GLatLng coordenadas) { //GLatLng ubicacion = new GLatLng(coordenadas); GMap1.setCenter(coordenadas, 15); GMap1.Height = 460; GMap1.Width = 560; //Adiciona el control de la parte izq superior (moverse, ampliar y reducir) GMap1.addControl(new GControl(GControl.preBuilt.LargeMapControl)); //GControl.preBuilt.MapTypeControl: permite elegir un tipo de mapa y otro. GMap1.addControl(new GControl(GControl.preBuilt.MapTypeControl)); //Pone la marca de gota de agua con el nombre de la ubicacion GMarker marker = new GMarker(coordenadas); string strMarker = "<div style='width: 185px; height: 100px'><b>" + "SGME_MAPS</b><br> " + region + "<br />" + comuna + ", " + provincia + "<br />" + "" + direccion + "</div>"; GInfoWindow window = new GInfoWindow(marker, strMarker, true); GMap1.addInfoWindow(window); GMap1.enableHookMouseWheelToZoom = true; //Tipo de mapa a mostrar GMap1.mapType = GMapType.GTypes.Normal; //Moverse con el cursor del teclado GMap1.enableGKeyboardHandler = true; GMap1.ShowMapTypeControl = true; //GMap1.GZoom = 9; //GMap1.Add(new GControl(GControl.preBuilt.LargeMapControl)); //GeoCoding geoCoding = new GeoCoding(); //geoCoding.show = GeoCoding.ShowEnum.infowindow; //geoCoding.openedOnLoad = true; //geoCoding.errorText = "Not found"; //geoCoding.buttonText = "Search"; //geoCoding.infoText = "GeoCode"; //geoCoding.baseCountryCode = "au"; // Search Newcastle, and you'll find it elsewhere... //// geoCoding.viewport = new GLatLngBounds(new GLatLng(44, 14), new GLatLng(46, 16)); //geoCoding.showErrorCode = true; //GMap1.Add(geoCoding); //Con esto podemos definir el icono que se mostrara en la ubicacion //#region Crear Icono //GIcon iconPropio = new GIcon(); //iconPropio.image = "../images/iconBuilding.png"; //iconPropio.shadow = "../images/iconBuildingS.png"; //iconPropio.iconSize = new GSize(32, 32); //iconPropio.shadowSize = new GSize(29, 16); //iconPropio.iconAnchor = new GPoint(10, 18); //iconPropio.infoWindowAnchor = new GPoint(10, 9); //#endregion }
// Methods protected void btnSearchByKeyword_Click(object sender, EventArgs e) { GeoCode code = GMap.geoCodeRequest(this.GetKeywords(), this.ctlGoogleMap.Key); if (code.Status.code == 200) { this.ctlGoogleMap.setCenter(code.Placemark.coordinates); GMarker gMarker = new GMarker(code.Placemark.coordinates); GInfoWindow infoWindow = new GInfoWindow(gMarker, "<center><b>" + code.Placemark.address + "</b></center>", false, GListener.Event.mouseover); this.ctlGoogleMap.addInfoWindow(infoWindow); } }
protected string GMap1_Click(object s, GAjaxServerEventArgs e) { GMarker marker = new GMarker(e.point); GInfoWindow window = new GInfoWindow(marker, string.Format(@"<b>GLatLngBounds</b><br />SW = {0}<br/>NE = {1}", e.bounds.getSouthWest().ToString(), e.bounds.getNorthEast().ToString()) , true); return window.ToString(e.map); }
protected string GMap1_Click(object s, GAjaxServerEventArgs e) { GMarker marker = new GMarker(e.point); GInfoWindow window = new GInfoWindow(marker, string.Format(@"<b>GLatLngBounds</b><br />SW = {0}<br/>NE = {1}", e.bounds.getSouthWest().ToString(), e.bounds.getNorthEast().ToString()) , true); return(window.ToString(e.map)); }
protected void Page_Load(object sender, EventArgs e) { //مواقع البيوت على الخريطه //some test //مدينة بغداد GLatLng latlng = new GLatLng(33.303708016355245, 44.3720680475235); GLatLng latlng1 = new GLatLng(33.30494095074294, 44.3713653087616); GLatLng latlng2 = new GLatLng(33.306223184015565, 44.37358617782593); //مدينة كربلاء GLatLng latlng3 = new GLatLng(32.615039238431486, 44.03835028409958); GLatLng latlng4 = new GLatLng(32.61548656961024, 44.03770387172699); GLatLng latlng5 = new GLatLng(32.61622759816053, 44.037339091300964); GMap1.enableHookMouseWheelToZoom = true; GMap1.setCenter(latlng, 7, GMapType.GTypes.Hybrid); //اضهار صورة مقربة للموقع //GMarker marker = new GMarker(latlng); //GInfoWindowOptions IWoptions = new GInfoWindowOptions(17, GMapType.GTypes.Hybrid); //GShowMapBlowUp mbUp = new GShowMapBlowUp(marker, false, IWoptions); //gMap.addShowMapBlowUp(mbUp); GInfoWindowTabs iwTabs = new GInfoWindowTabs(); GMarker icono1 = new GMarker(latlng); iwTabs.gMarker = icono1; iwTabs.point = latlng; List<GInfoWindowTab> tabs = new List<GInfoWindowTab>(); tabs.Add(new GInfoWindowTab("معلومات عامه " , "نكتب بعض المعلومات")); tabs.Add(new GInfoWindowTab("صور ", "نضغ بعض الصور")); tabs.Add(new GInfoWindowTab("الإتصال ", "<div class='info' >الإتصال بالمكتب العقاري</div>")); iwTabs.tabs = tabs; GMap1.addInfoWindowTabs(iwTabs); GMarker icono2 = new GMarker(latlng3); GInfoWindow window2 = new GInfoWindow(icono2, "عماره <b>عماره سلام ان شاء الله</b>", false, GListener.Event.click); GMap1.addInfoWindow(window2); GInfoWindowTabs iwTabs2 = new GInfoWindowTabs(); GMarker icono = new GMarker(latlng5); iwTabs2.gMarker = icono; iwTabs2.tabs = tabs; GMap1.addInfoWindowTabs(iwTabs2); }
protected string GMap1_Click(object s, GAjaxServerEventArgs e) { string respuesta = string.Empty; Punto pun = new Punto(); pun.longitud = e.point.lng.ToString(); pun.latitud = e.point.lat.ToString(); listaPunto.Add(pun); Session["listaPunto"] = listaPunto; if (DropDownList1.SelectedValue == "Punto") { GIcon icon = new GIcon(); icon.image = "https://www.google.es/maps/vt/icon/name=icons/spotlight/spotlight-poi-medium.png&scale=2?scale=1"; icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png"; GMarkerOptions mOpts = new GMarkerOptions(); mOpts.clickable = true; mOpts.icon = icon; GMarker marker = new GMarker(e.point, mOpts); GInfoWindow window = new GInfoWindow(marker, string.Format( @"<b>Longitud y Latitud del Punto</b><br />SW = {0}<br/>NE = {1} <br /> LatLogn{2}", e.bounds.getSouthWest(), e.bounds.getNorthEast(), e.point ), true); txtNombre.Focus(); txtLatitud.Text = e.point.lat.ToString(); txtLongitud.Text = e.point.lng.ToString(); txtNombre.Text = string.Empty; btnInsertar.Enabled = true; btnLimpiar.Enabled = true; respuesta = window.ToString(e.map); } if (DropDownList1.SelectedValue == "Linea" && listaPunto.Count > 1) { GMarker marker = new GMarker(e.point); GInfoWindow window = new GInfoWindow(marker, string.Format( @"<b>Longitud y Latitud del Punto</b><br />SW = {0}<br/>NE = {1} <br /> LatLogn{2}", e.bounds.getSouthWest(), e.bounds.getNorthEast(), e.point ), true); respuesta = window.ToString(e.map); } return(respuesta); }
protected void Page_Load(object sender, EventArgs e) { GMap1.Visible = true; GMap2.Visible = false; GMap3.Visible = false; if (cbodistritos.SelectedValue.ToString() == "1") { lbldireccion.Text = "Av. Oscar R. Benavides, 4706 - Bellavista"; GLatLng latlng = new GLatLng(-12.053183880322681, -77.09490269422531); GMap1.setCenter(latlng, 17, GMapType.GTypes.Hybrid); GMarker marker = new GMarker(latlng); GInfoWindowOptions IWoptions = new GInfoWindowOptions(12, GMapType.GTypes.Normal); GInfoWindow mbUp = new GInfoWindow(marker, "Av. Oscar R. Benavides, 4706 - Bellavista", IWoptions); GMap1.addInfoWindow(mbUp); GMap1.addGMarker(new GMarker(latlng + new GLatLng(2, 1))); GMap1.enableHookMouseWheelToZoom = true; } else if (cbodistritos.SelectedValue.ToString() == "2") { lbldireccion.Text = "Av. Arequipa 2210 - Lince"; GMap2.Visible = true; GMap1.Visible = false; GMap3.Visible = false; GLatLng latlng = new GLatLng(-12.086198524323004, -77.0346736907959); GMap2.setCenter(latlng, 17, GMapType.GTypes.Hybrid); GMarker marker = new GMarker(latlng); GInfoWindowOptions IWoptions = new GInfoWindowOptions(12, GMapType.GTypes.Normal); GInfoWindow mbUp = new GInfoWindow(marker, "Av. Arequipa 2210 - Lince", IWoptions); GMap2.addInfoWindow(mbUp); GMap2.addGMarker(new GMarker(latlng + new GLatLng(2, 1))); GMap2.enableHookMouseWheelToZoom = true; } else if (cbodistritos.SelectedValue.ToString() == "3") { lbldireccion.Text = "Av. Larco 2210 - Miraflores"; GMap3.Visible = true; GMap2.Visible = false; GMap1.Visible = false; GLatLng latlng = new GLatLng(-12.120984474783656, -77.02883720397949); GMap3.setCenter(latlng, 17, GMapType.GTypes.Hybrid); GMarker marker = new GMarker(latlng); GInfoWindowOptions IWoptions = new GInfoWindowOptions(12, GMapType.GTypes.Normal); GInfoWindow mbUp = new GInfoWindow(marker, "Av. Larco 2210 - Miraflores", IWoptions); GMap3.addInfoWindow(mbUp); GMap3.addGMarker(new GMarker(latlng + new GLatLng(2, 1))); GMap3.enableHookMouseWheelToZoom = true; } }
protected string OnGoogleMapClick(object s, GAjaxServerEventArgs e) { GMarker marker = new GMarker(e.point); GInfoWindow window = new GInfoWindow(marker, string.Format( @"<b>GLatLngBounds</b><br/>NE = {0}", e.bounds.getNorthEast()), true); this.coordinates = e.bounds.getNorthEast().ToString().Split(','); return(window.ToString(e.map)); }
protected string OnGoogleMapClick(object s, GAjaxServerEventArgs e) { GMarker marker = new GMarker(e.point); GInfoWindow window = new GInfoWindow(marker, string.Format( @"<b>GLatLngBounds</b><br/>NE = {0}", e.bounds.getNorthEast()), true); this.coordinates = e.bounds.getNorthEast().ToString().Split(','); return window.ToString(e.map); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { GLatLng ubicacion = new GLatLng(40.381090863719436, -3.6222052574157715); GMap1.setCenter(ubicacion, 15); //Establecemos alto y ancho en px GMap1.Height = 560; GMap1.Width = 660; //Adiciona el control de la parte izq superior (moverse, ampliar y reducir) GMap1.Add(new GControl(GControl.preBuilt.LargeMapControl)); //GControl.preBuilt.MapTypeControl: permite elegir un tipo de mapa y otro. GMap1.Add(new GControl(GControl.preBuilt.MapTypeControl)); //Con esto podemos definir el icono que se mostrara en la ubicacion //#region Crear Icono //GIcon iconPropio = new GIcon(); //iconPropio.image = "../images/iconBuilding.png"; //iconPropio.shadow = "../images/iconBuildingS.png"; //iconPropio.iconSize = new GSize(32, 32); //iconPropio.shadowSize = new GSize(29, 16); //iconPropio.iconAnchor = new GPoint(10, 18); //iconPropio.infoWindowAnchor = new GPoint(10, 9); //#endregion //Pone la marca de gota de agua con el nombre de la ubicacion GMarker marker = new GMarker(ubicacion); string strMarker = "<div style='width: 250px; height: 185px'><b>" + "<span style='color:#ff7e00'>es</span>ASP.NET</b><br>" + " C/ C/ Nombre de Calle, No X <br /> 28031 Madrid, España <br />" + "Tel: +34 902 00 00 00 <br />Fax: +34 91 000 00 00<br />" + "Web: <a href='http://www.esASP.net/' class='txtBKM' >www.esASP.net</a>" + "<br />Email: <a href='mailto:[email protected]' class='txtBKM'>" + "[email protected]</a><br><br></div>"; GInfoWindow window = new GInfoWindow(marker, strMarker, true); GMap1.Add(window); GMap1.enableHookMouseWheelToZoom = true; //Tipo de mapa a mostrar GMap1.mapType = GMapType.GTypes.Normal; //Moverse con el cursor del teclado GMap1.enableGKeyboardHandler = true; } }
private void initialize() { GLatLng ubicacion = new GLatLng(40.381090863719436, -3.6222052574157715); GLatLng ubicacion2 = new GLatLng(42.381090863719436, -3.6222052574157715); //Establecemos alto y ancho en px GMap1.Height = 480; GMap1.Width = 575; //Adiciona el control de la parte izq superior (moverse, ampliar y reducir) GMap1.Add(new GControl(GControl.preBuilt.LargeMapControl)); //GControl.preBuilt.MapTypeControl: permite elegir un tipo de mapa y otro. GMap1.Add(new GControl(GControl.preBuilt.MapTypeControl)); //Con esto podemos definir el icono que se mostrara en la ubicacion //#region Crear Icono //GIcon iconPropio = new GIcon(); //iconPropio.image = "../images/iconBuilding.png"; //iconPropio.shadow = "../images/iconBuildingS.png"; //iconPropio.iconSize = new GSize(32, 32); //iconPropio.shadowSize = new GSize(29, 16); //iconPropio.iconAnchor = new GPoint(10, 18); //iconPropio.infoWindowAnchor = new GPoint(10, 9); //#endregion //Pone la marca de gota de agua con el nombre de la ubicacion GMarker marker = new GMarker(ubicacion); GMarker marker2 = new GMarker(ubicacion2); string strMarker = "<div style='width: 150px; height: 85'>" + "<br>" + " C/ C/ Nombre de Calle, No X <br /> 28031 Madrid, España " + "<br />" + "Tel: +34 902 00 00 00 <br />" + "Fax: +34 91 000 00 00<br />" + "</div>"; GInfoWindow window = new GInfoWindow(marker, strMarker, true); GInfoWindow window2 = new GInfoWindow(marker2, strMarker + "Hola Desu", true); GMap1.Add(window); GMap1.Add(window2); GMap1.setCenter(ubicacion2, 15); GMap1.enableHookMouseWheelToZoom = true; //Tipo de mapa a mostrar GMap1.mapType = GMapType.GTypes.Normal; //Moverse con el cursor del teclado GMap1.enableGKeyboardHandler = true; }
public void AddOfficeToMap(int office_id) { var office = db.Offices.FirstOrDefault(p => p.office_id == office_id); GLatLng latlon = default(GLatLng); GMarker marker = default(GMarker); GInfoWindow window = default(GInfoWindow); string winText = null; winText = "<b>" + office.office_nm + "<br />" + office.street_addrs + "<br />" + office.city_st_zip + "<br />" + office.ph_no + "</b>"; latlon = new GLatLng((double)office.dec_lat_va, (double)office.dec_long_va); marker = new GMarker(latlon); window = new GInfoWindow(marker, winText, false, GListener.Event.click); GMap.addInfoWindow(window); }
protected void Page_Load(object sender, EventArgs e) { GLatLng latlng = new GLatLng(44, 9); GLatLng relativo = new GLatLng(2, -6); GMarker marker1 = new GMarker(latlng + relativo); GMarker marker2 = new GMarker(latlng - relativo); GMarker marker3 = new GMarker(latlng + relativo + relativo); GMap1.setCenter(latlng, 4, GMapType.GTypes.Hybrid); GInfoWindow window = new GInfoWindow(latlng, "InfoWindow. Close me please."); GInfoWindowOptions options1 = new GInfoWindowOptions(); options1.onCloseFn = "function(){alert('Thanks! You have closed me ;D')}"; window.options = options1; GMap1.Add(window); }
protected void Page_Load(object sender, EventArgs e) { GMap1.setCenter(new GLatLng(41, 3), 3); GMap1.Add(new GControl(GControl.preBuilt.LargeMapControl)); GMarker m1 = new GMarker(new GLatLng(41, 3)); MarkerManager mManager = new MarkerManager(); mManager.Add(m1, 2); List<GMarker> mks = new List<GMarker>(); List<GInfoWindow> iws = new List<GInfoWindow>(); Random r = new Random(); double ir1, ir2; GMarker mkr; for (int i = 0; i < 10; i++) { ir1 = (double)r.Next(40) / 10.0 - 2.0; ir2 = (double)r.Next(40) / 10.0 - 2.0; mkr = new GMarker(m1.point + new GLatLng(ir1, ir2)); mks.Add(mkr); GMap1.Add(new GListener(mkr.ID, GListener.Event.click, "function(){alert('" + i + "');}")); } for (int i = 0; i < 5; i++) { ir1 = (double)r.Next(40) / 20.0 - 1; ir2 = (double)r.Next(40) / 20.0 - 1; mkr = new GMarker(m1.point + new GLatLng(ir1, ir2)); GInfoWindow window = new GInfoWindow(mkr, i.ToString()); iws.Add(window); } mManager.Add(mks, 6, 8); mManager.Add(iws, 7, 8); GMap1.markerManager = mManager; }
protected void Page_Load(object sender, EventArgs e) { PopupMarker popupMarkerA = new PopupMarker(new GLatLng(39, -7), "Answer to the Ultimate Question of Life, the Universe, and Everything"); PopupMarkerOptions popupMarkerOptionsB = new PopupMarkerOptions(Color.WhiteSmoke, Color.DarkRed); PopupMarker popupMarkerB = new PopupMarker(new GLatLng(42, -5), "Maecenas a diam lectus.", popupMarkerOptionsB); PopupMarkerChartAPIOptions popupMarkerChartApiOptionsC = new PopupMarkerChartAPIOptions(Color.LightGreen, Color.Black, PopupMarkerChartAPIOptions.ChartStyleEnum.d_bubble_icon_text_small, PinIcons.taxi); PopupMarkerOptions popupMarkerOptionsC = new PopupMarkerOptions(PopupMarkerOptions.PopupMarkerOptionsStylesEnum.chart, popupMarkerChartApiOptionsC); popupMarkerOptionsC.draggable = true; PopupMarker popupMarkerC = new PopupMarker(new GLatLng(40, -4), "Hi! Drag me.", popupMarkerOptionsC); GInfoWindow infoWindowA = new GInfoWindow(popupMarkerA, "42 is the answer."); GMap1.Add(infoWindowA); GMap1.Add(popupMarkerB); GMap1.Add(popupMarkerC); }
public void LlenarMapaConClientes(ArrayList clientes, GMap map) { GLatLng ubicacion; GMarker marker; string strMarker; foreach (ZoCliente c in clientes) { ubicacion = new GLatLng(c.Latitud, c.Longitud); //Pone la marca de gota de agua con el nombre de la ubicacion marker = new GMarker(ubicacion); strMarker = "<div style='width: 150px; height: 85px'><b>" + "<span style='color:#ff7e00'></span></b><br>" + " " + c.RazSoc + " <br /> " + c.DirSuc + " <br />" + "</div>"; GInfoWindow window = new GInfoWindow(marker, strMarker, false); map.Add(window); } }
protected void Page_Load(object sender, EventArgs e) { GLatLng latLng = new GLatLng(50, 10); GMap1.setCenter(latLng); GIcon icon = new GIcon(); icon.image = "http://gmaps-samples.googlecode.com/svn/trunk/markers/circular/greencirclemarker.png"; icon.iconSize = new GSize(32, 32); icon.iconAnchor = new GPoint(16, 16); icon.infoWindowAnchor = new GPoint(25, 7); LabeledMarker labeledMarker = new LabeledMarker(latLng); labeledMarker.options.labelText = "S"; labeledMarker.options.labelOffset = new GSize(-4, -7); labeledMarker.options.icon = icon; GInfoWindow window = new GInfoWindow(labeledMarker, "You can use the Labeled Marker as any other marker"); GMap1.Add(window); }
protected void Page_Load(object sender, EventArgs e) { GLatLng latLng = new GLatLng(50, 10); GMap1.setCenter(latLng); GIcon icon = new GIcon(); icon.image = "http://gmaps-samples.googlecode.com/svn/trunk/markers/circular/greencirclemarker.png"; icon.iconSize = new GSize(32, 32); icon.iconAnchor = new GPoint(16, 16); icon.infoWindowAnchor = new GPoint(25, 7); StyledIconOptions iconOptions1 = new StyledIconOptions() { Text = "Hi", Color = Color.Blue, Fore = Color.Red, StarColor = Color.Green }; StyledIcon icon1 = new StyledIcon(StyledIconType.Marker, iconOptions1); StyledMarker styledMarker1 = new StyledMarker(latLng, icon1); StyledIconOptions iconOptions2 = new StyledIconOptions() { Text = "Hi, I'm a bubble!", Color = Color.Orange, Fore = Color.PaleGreen, }; StyledIcon icon2 = new StyledIcon(StyledIconType.Bubble, iconOptions2); StyledMarker styledMarker2 = new StyledMarker(latLng + new GLatLng(1.0, 1.0), icon2); GInfoWindow window1 = new GInfoWindow(styledMarker1, "You can user StyledMarker as any other marker!"); GInfoWindow window2 = new GInfoWindow(styledMarker2, "You can user StyledMarker as any other marker!"); GMap1.Add(window1); GMap1.Add(window2); }
protected string GMap1_Click(object s, GAjaxServerEventArgs e) { inverseGeocodingManager igeoManager = new inverseGeocodingManager(e.point, "es"); inverseGeocoding iGeos = igeoManager.inverseGeoCodeRequest(); geoName geo; if (iGeos.geonames.Count > 0) { geo = iGeos.geonames[0]; StringBuilder sb = new StringBuilder(); sb.Append("<div align=\"left\">"); sb.Append("<b>Nearest Place</b>"); sb.Append("<br />"); sb.AppendFormat("Place name: <i>{0}</i> ", geo.name); sb.Append("<br />"); sb.AppendFormat("Point: <i>{0}</i>", geo.nearestPlacePoint.ToString()); sb.Append("<br />"); sb.AppendFormat("Elevation: <i>{0}</i>", geo.nearestPlaceElevation > -9000 ? geo.nearestPlaceElevation.ToString() : "No info"); sb.Append("<br />"); sb.AppendFormat("Country Name (Code): <i>{0} ({1})</i>", geo.countryName, geo.countryCode); sb.Append("<br />"); sb.AppendFormat("Click point - Nearest Place distance (Km): <i>{0}</i>", Math.Round(geo.distance, 3)); sb.Append("</div>"); sb.Append("<br />"); sb.Append("<div align=\"left\">"); sb.Append("<b>Click point</b>"); sb.Append("<br />"); sb.AppendFormat("Point: <i>{0}</i>", geo.initialPoint.ToString()); sb.Append("<br />"); sb.AppendFormat("Elevation: <i>{0}</i>", geo.initialPointElevation > -9000 ? geo.initialPointElevation.ToString() : "No info"); sb.Append("<br />"); sb.Append("</div>"); GInfoWindow window = new GInfoWindow(e.point, sb.ToString(), true); return window.ToString(e.map); } else return string.Empty; }
protected void Page_Load(object sender, EventArgs e) { GLatLng latlon = new GLatLng(40.6310452, -8.658024399999931); GMap1.setCenter(latlon, 4); GMap1.GZoom = 13; GMarker icono = new GMarker(latlon); GInfoWindow window = new GInfoWindow(icono, "Universidade de Aveiro, Portugal", false, GListener.Event.mouseover); GMap1.addInfoWindow(window); getWeather(); Label3.Text = Humidity+" %"; Label5.Text = WindSpeed+" km/h"; Label1.Text = Temperature; double cel = ((Convert.ToDouble(Temperature) - 32.0) / 1.8000); Label4.Text = Condition; Label2.Text = Convert.ToInt32(cel).ToString(); if (Condition == "Mostly Cloudy") Label6.CssClass = "pe-7w-cloud-sun pe-3x pe-va"; else if (Condition == "Mist") Label6.CssClass = "pe-7w-drizzle-alt pe-3x pe-va"; else if (Condition == "Fog") Label6.CssClass = "pe-7w-fog pe pe-3x pe-va"; else if (Condition == "Cloudy") Label6.CssClass = "pe-7w-cloud pe pe-3x pe-va"; else Label6.CssClass = "pe-7w-sun pe-3x pe-va"; }
protected void Page_Load(object sender, EventArgs e) { this.ctlGoogleMap.Key = ConfigurationManager.AppSettings["GoogleAPIKey"].ToString(); this.ctlGoogleMap.addControl(new GControl(GControl.preBuilt.LargeMapControl)); if (!this.Page.IsPostBack) { base.Keywords = ""; base.Description = ""; this.oLocation.CountryID = 2; DataSet set = this.oLocation.LoadAll(); this.oHelp.LoadData(set.Tables[0], this.ddlCountry); this.oHelp.LoadData(set.Tables[1], this.ddlProvince); this.Page.DataBind(); this.oHelp.SelectedByText(this.ddlCountry, NCountry.CANADA.ToString()); GeoCode code = GMap.geoCodeRequest(this.GetQuery(), this.ctlGoogleMap.Key); if (code.Status.code == 200) { this.ctlGoogleMap.setCenter(code.Placemark.coordinates); GMarker gMarker = new GMarker(code.Placemark.coordinates); GInfoWindow infoWindow = new GInfoWindow(gMarker, "<center><b>" + code.Placemark.address + "</b></center>", false, GListener.Event.mouseover); this.ctlGoogleMap.addInfoWindow(infoWindow); } } }
protected void Page_Load(object sender, EventArgs e) { GMapUIOptions options = new GMapUIOptions(); options.zoom_scrollwheel = true; //options GMap1.addGMapUI(new GMapUI(options)); //setcenter GMap1.setCenter(new GLatLng(-7.197617, 112.73288),15, GMapType.GTypes.Satellite); //add red marker GLatLng redPosition = new GLatLng(-7.197681, 112.72429); XPinLetter xPinLetter = new XPinLetter(PinShapes.pin_star, "A", Color.White, Color.Black, Color.Red); GMarker redMarker = new GMarker(redPosition, new GMarkerOptions(new GIcon(xPinLetter.ToString(), xPinLetter.Shadow()))); //add info window GInfoWindowOptions IWoptions = new GInfoWindowOptions(12, GMapType.GTypes.Normal); GInfoWindow mbUp = new GInfoWindow(redMarker, "<i>I'm in</i> <a style='color:red'>RED</a> <b>Condition</b>", IWoptions); GMap1.addGMarker(redMarker); GMap1.addInfoWindow(mbUp); //add green marker GLatLng greenPosition = new GLatLng(-7.19651, 112.731035); xPinLetter = new XPinLetter(PinShapes.pin_star, "B", Color.White, Color.Black, Color.Green); GMarker greenMarker = new GMarker(greenPosition, new GMarkerOptions(new GIcon(xPinLetter.ToString(), xPinLetter.Shadow()))); //add info window IWoptions = new GInfoWindowOptions(12, GMapType.GTypes.Normal); mbUp = new GInfoWindow(greenMarker, "<i>I'm in</i> <a style='color:green'>GREEN</a> <b>Condition</b>", IWoptions); GMap1.addGMarker(greenMarker); GMap1.addInfoWindow(mbUp); }
protected void Page_Load(object sender, EventArgs e) { if (Session["uname"] == null) { Response.Redirect("Index.aspx"); } string id = Request.QueryString["id"]; double lat = 0, lon = 0; // SELECT Cab.Cab_ID, CabLocations.Latitude, CabLocations.Longitude FROM Cab INNER JOIN CabLocations ON Cab.Cab_ID=CabLocations.Cab_ID WHERE Cab.Cab_RegNo = 'VY-702'; DataTable dt = new DataTable(); SqlConnection connection = new SqlConnection(@"Data Source=WALEED-PC;Initial Catalog=Cab9;Integrated Security=True"); connection.Open(); SqlCommand sqlCmd = new SqlCommand("SELECT Cab.Cab_ID, CabLocations.Latitude, CabLocations.Longitude FROM Cab INNER JOIN CabLocations ON Cab.Cab_ID=CabLocations.Cab_ID WHERE Cab.Cab_RegNo = '" + id + "'", connection); SqlDataAdapter sqlDa = new SqlDataAdapter(sqlCmd); sqlDa.Fill(dt); if (dt.Rows.Count > 0) { lat = Convert.ToDouble(dt.Rows[0]["Latitude"]); lon = Convert.ToDouble(dt.Rows[0]["Longitude"]); } connection.Close(); GLatLng latlng = new GLatLng(lat, lon); GMapType.GTypes mType = GMapType.GTypes.Normal; GMap1.setCenter(latlng, 15, mType); /////////////////////////////////////////////// GMap1.Add(new GControl(GControl.preBuilt.LargeMapControl)); GMarker m1 = new GMarker(new GLatLng(lat, lon)); MarkerManager mManager = new MarkerManager(); mManager.Add(m1, 10); List<GMarker> mks = new List<GMarker>(); List<GInfoWindow> iws = new List<GInfoWindow>(); Random r = new Random(); GMarker mkr; for (int i = 0; i < 5; i++) { double ir1 = r.Next(40) / 10.0 - 2.0; double ir2 = r.Next(40) / 10.0 - 2.0; mkr = new GMarker(m1.point + new GLatLng(lat, lon)); mks.Add(mkr); GMap1.Add(new GListener(mkr.ID, GListener.Event.click, "function(){alert('" + i + "');}")); } for (int i = 0; i < 5; i++) { double ir1 = r.Next(40) / 20.0 - 1; double ir2 = r.Next(40) / 20.0 - 1; mkr = new GMarker(m1.point + new GLatLng(lat, lon)); GInfoWindow window = new GInfoWindow(mkr, i.ToString()); iws.Add(window); } mManager.Add(mks, 5, 6); mManager.Add(iws, 7, 8); GMap1.markerManager = mManager; /////////////////////////////////////////////////////////////////// string cab = ""; DataTable dt1 = new DataTable(); SqlConnection connection1 = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection1"].ConnectionString.ToString()); connection1.Open(); SqlCommand sqlCmd1 = new SqlCommand("Select Cab_ID from Cab where Cab_RegistrationNumber='" + id + "'", connection1); SqlDataAdapter sqlDa1 = new SqlDataAdapter(sqlCmd); sqlDa.Fill(dt1); if (dt.Rows.Count > 0) { cab = dt.Rows[0]["Cab_ID"].ToString(); } connection.Close(); ///////////////////////////////////////////////////////////////// DataTable dt2 = new DataTable(); SqlConnection connection2 = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection1"].ConnectionString.ToString()); connection2.Open(); SqlCommand sqlCmd2 = new SqlCommand("Select SUM([Booking_Fare]) As Total from Booking where Cab_ID='" + cab + "'", connection2); SqlDataAdapter sqlDa2 = new SqlDataAdapter(sqlCmd2); sqlDa2.Fill(dt2); string fare = ""; if (dt2.Rows.Count > 0) { fare = dt2.Rows[0]["Total"].ToString(); } ASPxGaugeControl1.Value = fare; connection.Close(); /////////////////////////////////////////////////////////////////////////////////////////////////////// //SELECT DISTINCT([Booking_Source]), COUNT([Booking_Source]) FROM [Booking] GROUP BY Booking_Source SqlDataSource1.SelectCommand = "SELECT DISTINCT([Booking_Source]), COUNT([Booking_Source]) FROM [Booking] where Cab_ID='" + cab + "' GROUP BY Booking_Source "; SqlDataSource2.SelectCommand = "SELECT DISTINCT([Booking_Destination]), COUNT([Booking_Destination]) FROM [Booking] where Cab_ID='" + cab + "' GROUP BY Booking_Destination "; }
protected void Page_Load(object sender, EventArgs e) { GMap1.Language = "it"; GMap1.Height = 400; GMap1.Width = 800; GMap1.mapType = GMapType.GTypes.Normal; //GMap1.addMapType(GMapType.GTypes.Physical); //GMap1.addControl(new GControl(GControl.preBuilt.MapTypeControl)); GMap1.enableRotation = true; GMap1.enableHookMouseWheelToZoom = true; GMap1.enableGKeyboardHandler = true; GeoCode geo = GMap.geoCodeRequest("Pradamano Via Cussignacco, 78/38", "ABQIAAAAXXGwzlc4Ai2aLclXJZRLmBSVMExDJOfktRi92ds7_1jWp3InaRTCRpYSJA6ijYv8qRenFAD7AHN3GQ"); GMap1.setCenter(geo.Placemark.coordinates, 10); GMarker icono2 = new GMarker(geo.Placemark.coordinates); GInfoWindow window2 = new GInfoWindow(icono2, "Udine Via Cussignacco <b>Home --SUPER</b>", false, GListener.Event.mouseover); GMap1.Add(window2); string strWhere = @"SELECT dbo.Assistenza.IDAss, dbo.Assistenza.IDCli, dbo.Assistenza.UserAnswer, dbo.Assistenza.UserPrefer, dbo.Assistenza.MsgBreve, dbo.Assistenza.Messaggio, dbo.Assistenza.bEnd, dbo.Assistenza.bOKRecal, dbo.Assistenza.bVisit, dbo.Assistenza.bAppFissato, dbo.Assistenza.TimeCreate, dbo.Assistenza.TimeMod, users_1.Nome, dbo.users.Nome AS Expr1, dbo.Clienti.RagioneSoc, dbo.Assistenza.GruppoBase, dbo.Assistenza.Priorita, dbo.Assistenza.IDCalendario, dbo.Calendario.Data, dbo.Clienti.IDFornitore, dbo.Fornitori.RagioneSociale, dbo.Clienti.IDZona, dbo.Zone.Descrizione, dbo.Assistenza.bRappEseguito, dbo.Assistenza.bScadEseguito, dbo.Assistenza.bVerificaP, dbo.Clienti.Indirizzo, dbo.Clienti.Localita, dbo.Clienti.Cap, dbo.Clienti.Provincia,dbo.Clienti.GeoLat,dbo.Clienti.GeoLon FROM dbo.Fornitori RIGHT OUTER JOIN dbo.Assistenza INNER JOIN dbo.Clienti ON dbo.Assistenza.IDCli = dbo.Clienti.IDCliente INNER JOIN dbo.Zone ON dbo.Clienti.IDZona = dbo.Zone.IDZona ON dbo.Fornitori.IDFornitori = dbo.Clienti.IDFornitore LEFT OUTER JOIN dbo.Calendario ON dbo.Assistenza.IDCalendario = dbo.Calendario.IDCal LEFT OUTER JOIN dbo.users ON dbo.Assistenza.UserPrefer = dbo.users.IDUser LEFT OUTER JOIN dbo.users AS users_1 ON dbo.Assistenza.UserAnswer = users_1.IDUser WHERE (dbo.Assistenza.bEnd = 0) AND (dbo.Assistenza.GruppoBase = 1)"; SqlDataAdapter adap = new SqlDataAdapter(strWhere, SqlDataSourceAssistenze.ConnectionString); DataTable dt = new DataTable(); adap.Fill(dt); int iInseriti = 0; foreach (DataRow dr in dt.Rows) { GMarker iconoDR= null; bool bValid = false; string sLocPar = dr["Localita"].ToString() + " " + dr["Indirizzo"].ToString(); if (dr["geolat"].ToString() == "" && dr["geolon"].ToString() == "") { geo = GMap.geoCodeRequest(sLocPar, "ABQIAAAAXXGwzlc4Ai2aLclXJZRLmBSVMExDJOfktRi92ds7_1jWp3InaRTCRpYSJA6ijYv8qRenFAD7AHN3GQ"); if (geo.valid) { string UpdateCliente = "UPDATE CLienti SET GeoLat='" + geo.Placemark.coordinates.lat.ToString() + "' , GeoLon ='" + geo.Placemark.coordinates.lng.ToString() + "' WHERE IDCliente =" + dr["IDCli"].ToString(); SqlConnection cnn = new SqlConnection(SqlDataSourceAssistenze.ConnectionString); cnn.Open(); SqlCommand cmd = new SqlCommand(UpdateCliente, cnn); int i = cmd.ExecuteNonQuery(); cnn.Close(); } iconoDR = new GMarker(geo.Placemark.coordinates); } else { GLatLng Pos = new GLatLng(double.Parse(dr["geoLat"].ToString()),double.Parse(dr["geoLon"].ToString())); iconoDR = new GMarker(Pos); bValid = true; } if (geo.valid | bValid) { string sAddAss = "http://serverhp/Assistenze/AssistenzaVisualizza.aspx?IDAss=" + dr["idass"].ToString() + "&IDCli=" + dr["idCli"].ToString(); string sInfo = "<a href='" + sAddAss + "'>" + dr["RagioneSoc"].ToString() + "</a></br>" + sLocPar + "<a></br><b>" + dr["MsgBreve"].ToString() + "</b>"; GInfoWindow windowDR = new GInfoWindow(iconoDR, sInfo, false, GListener.Event.mouseover); GMap1.Add(windowDR); iInseriti++; } else { string sAddCli = "http://serverhp/Anagrafica/Cliente.aspx?IDCli=" + dr["idCli"].ToString(); divMessage.InnerHtml += "<b>" + "<a href='" + sAddCli + "'>" + dr["RagioneSoc"].ToString() + "</a></b> " + sLocPar + "</br>"; } } Label1.Text = "Inseriti:" + iInseriti.ToString() + " su " + dt.Rows.Count + "elementi"; }