求懂百度地图api 大虾解决啊!!!!!!!!

解决方案 »

  1.   

    var map = new BMap.Map("container");
                                   var opts = { type: BMAP_NAVIGATION_CONTROL_LARGE }
                                   map.addControl(new BMap.NavigationControl(opts));
                                   map.addControl(new BMap.ScaleControl());
                                   map.addControl(new BMap.OverviewMapControl());
                                   map.addControl(new BMap.MapTypeControl());                               var GetAllLongitude = new Array();
                                   var GetaLat = new Array();
                                   var GetLongitudeOne = 1.1;
                                   var GetZeroLatitude = 1.1;                               $.ajax({
                                       async: false, 
                                       type: "POST",
                                       contentType: "application/json",
                                       url: "LocusQueries.aspx/GetAllLng",
                                       dataType: 'json',
                                       success: function GetAllLng1(result) {
                                         GetAllLongitude = result.d;
                                       }
                                   });                             $.ajax({
                                     async: false, 
                                       type: "POST",
                                       contentType: "application/json",
                                       url: "LocusQueries.aspx/GetAllLat",
                                       dataType: 'json',
                                       success: function GetAllLat1(result) {
                                           GetaLat = result.d;
                                       }
                                   });
                                   $.ajax({
                                       async: false, 
                                       type: "POST",
                                       contentType: "application/json",
                                       url: "LocusQueries.aspx/lastlng",
                                       dataType: 'json',
                                       success: function lastlng1(result) {
                                            GetLongitudeOne = result.d;
                                       }                               });
                                   $.ajax({
                                       async: false, 
                                       type: "POST",
                                       contentType: "application/json",
                                       url: "LocusQueries.aspx/lastlat",
                                       dataType: 'json',
                                       success: function lastlat1(result) {
                                            GetZeroLatitude = result.d;
                                       }
                                   });
                                   //                               初始化百度地图中心,并添加常用控件                                map.centerAndZoom(new BMap.Point(GetLongitudeOne,GetZeroLatitude),15);
                                   //                               画出折线即轨迹
                                    var point = [];
                                    var er = [];
                                   var r = GetAllLongitude.length;                               for (var i = 0; i < r; i++) {
                                       point[i] = new BMap.Point(GetAllLongitude[i], GetaLat[i]);
                                       er[i] = new BMap.Marker(point[i]);
                                       map.addOverlay(er[i]); // 将标注添加到地图中
                                   }                               var polyline = new BMap.Polyline();
                                       polyline.setPath(point);
                                       polyline.setStrokeColor("blue");
                                       polyline.getStrokeWeight(6);
                                       polyline.setStrokeOpacity(0.5);
                                       map.addOverlay(polyline);
                                       map.enableKeyboard();   //启用键盘,默认关闭
      

  2.   

                                  var GetAllLongitude = new Array();
                                   var GetaLat = new Array();
                                   var GetLongitudeOne = 1.1;
                                   var GetZeroLatitude = 1.1;             / /用来接收数据库返回的类型 $.ajax({                      //利用ajax 从后台输出数据到javascript
                                       async: false, 
                                       type: "POST",
                                       contentType: "application/json",
                                       url: "LocusQueries.aspx/lastlat",
                                       dataType: 'json',
                                       success: function lastlat1(result) {
                                            GetZeroLatitude = result.d;
                                       }
                                   });
       }
    //后台我用的webService.  前台javascript      .后台用的C#
        [WebMethod(Description = "获取签最后签到日的经度")]
        public static string lastlng()
        {
            Page page = new Page();
            JsonObject json = new JsonObject();
            SignInManage sig = new SignInManage();
            return sig.GetZeroLongitudeManage(page.Session["userName"].ToString());    }
        [WebMethod(Description = "获取签最后签到日的纬度")]
        public static string lastlat()
        {
            Page page = new Page();
            JsonObject json = new JsonObject();
            SignInManage sig = new SignInManage();
            return sig.GetZeroLatitudeManage(page.Session["userName"].ToString());    }
        [WebMethod(Description = "获取用户签到日所有的纬度")]
        public static List<string> GetAllLng()
        {
            Page page = new Page();
            JsonObject json = new JsonObject();
            SignInManage sig = new SignInManage();
            return sig.GetAllLongitudeManage(page.Session["SearDate"].ToString(), page.Session["userName"].ToString());    }
        [WebMethod(Description = "获取签最后签到日的所有经度")]
        public static List<string> GetAllLat()
        {
            Page page = new Page();
            JsonObject json = new JsonObject();
            SignInManage sig = new SignInManage();
            return sig.GetAllLatitudeManage(page.Session["SearDate"].ToString(), page.Session["userName"].ToString());    }