在我的网站上创建一个谷歌地图网络服务asp.net

时间:2015-12-04 22:21:31

标签: c# asp.net xml web-services google-maps

我正在尝试创建一个可以在我的网站上制作谷歌地图的网络服务,当我在我的网页上运行它时效果很好但是当单独运行网络服务时,我收到此错误消息“XML元素” EnableTheming'from namespace'http://tempuri.org/'已存在于当前范围内。使用XML属性为元素指定另一个XML名称或命名空间。“

[WebMethod]
public void gMap(GMap GMapc)
{

GLatLng mainLocation = new GLatLng(24.706114, 46.748883);
GMapc.setCenter(mainLocation, 10);//setting the map


List<goMap> mapList = new List<goMap>();// list of locations
mapList.Add(new goMap { area = "Riyadh", name = "جمعية البر بشمال الرياض", locat = "24.733591", locon = "46.679189", url = "https://www.google.com.sa/maps/place/%D8%AC%D9%85%D8%B9%D9%8A%D8%A9+%D8%A7%D9%84%D8%A8%D8%B1+%D8%A8%D8%B4%D9%85%D8%A7%D9%84+%D8%A7%D9%84%D8%B1%D9%8A%D8%A7%D8%B6%E2%80%AD/@24.7410639,46.7132029,13z/data=!4m7!1m4!3m3!1s0x0:0x0!2zMjTCsDQ0JzI3LjgiTiA0NsKwNDAnNDEuNSJF!3b1!3m1!1s0x0000000000000000:0x1b34d99dfdaf74e2?hl=ar" });
mapList.Add(new goMap { area = "Riyadh", name = "جمعية البر فرع الربوة و الجنادرية", locat = "24.786491", locon = "46.759167", url = "https://www.google.com.sa/maps/place/%D8%AC%D9%85%D8%B9%D9%8A%D8%A9+%D8%A7%D9%84%D8%A8%D8%B1+%D9%81%D8%B1%D8%B9+%D8%A7%D9%84%D8%B1%D9%88%D8%B6%D8%A9+%D9%88%D8%A7%D9%84%D8%AC%D9%86%D8%A7%D8%AF%D8%B1%D9%8A%D8%A9%E2%80%AD/@24.7687204,46.7602613,18z/data=!3m1!4b1!4m2!3m1!1s0x3e2f01e493abfc01:0x266757deff3c5dcc?hl=ar" });
         mapList.Add(new goMap { area = "Riyadh", name = "جمعية البر حي الربوة و النظيم", locat = "24.706114", locon = "46.748883", url = "https://www.google.com.sa/maps/place/%D8%AC%D9%85%D8%B9%D9%8A%D8%A9+%D8%A7%D9%84%D8%A8%D8%B1+%D8%A8%D8%AD%D9%8A+%D8%A7%D9%84%D8%B1%D8%A8%D9%88%D8%A9+%D9%88%D8%A7%D9%84%D9%86%D8%B8%D9%8A%D9%85%E2%80%AD/@24.7059528,46.7511043,17z/data=!3m1!4b1!4m2!3m1!1s0x3e2f0158682882f9:0xf6700b68148a1812?hl=ar" });
         mapList.Add(new goMap { area = "Riyadh", name = "جمعية البر حي الربوة", locat = "24.691767", locon = "46.748202", url = "https://www.google.com.sa/maps/place/%D8%AC%D9%85%D8%B9%D9%8A%D8%A9+%D8%A7%D9%84%D8%A8%D8%B1+%D8%A8%D8%AD%D9%8A+%D8%A7%D9%84%D8%B1%D8%A8%D9%88%D8%A9%E2%80%AD/@24.6915669,46.7504231,17z/data=!3m1!4b1!4m2!3m1!1s0x3e2f06aa7be39105:0x5c362d8d3b8b15df?hl=ar" });
         mapList.Add(new goMap { area = "Riyadh", name = "جمعية البر السلي", locat = "24.677303", locon = "46.816226", url = "https://www.google.com.sa/maps/place/%D8%AC%D9%85%D8%B9%D9%8A%D8%A9+%D8%A7%D9%84%D8%A8%D8%B1%E2%80%AD/@24.6770446,46.8184357,17z/data=!3m1!4b1!4m2!3m1!1s0x3e2f078339eb83df:0x6d911b7f817ed234?hl=ar" });

         //Add Zoom in Zoom out
         GControl control = new GControl(GControl.preBuilt.LargeMapControl);
         GControl control2 = new GControl(GControl.preBuilt.MenuMapTypeControl, new GControlPosition(GControlPosition.position.Top_Right));
         GMapc.Add(control);
         GMapc.Add(control2);
         GMapc.Add(new GControl(GControl.preBuilt.GOverviewMapControl, new GControlPosition(GControlPosition.position.Bottom_Left)));
         //pin variables
         PinIcon p;
         GMarker gm;
         GInfoWindow win;
         foreach (var i in mapList)//to display pin icons from the list
         {
             p = new PinIcon(PinIcons.home, Color.LightGreen);
             gm = new GMarker(new GLatLng(Convert.ToDouble(i.locat), Convert.ToDouble(i.locon)),
             new GMarkerOptions(new GIcon(p.ToString(), p.Shadow())));
             //window to show the map informatiom
             win = new GInfoWindow(gm, i.name + " <a href='" + i.url + "'></a>", false, GListener.Event.mouseover);
             GMapc.Add(win);
         }


 }

0 个答案:

没有答案