测试地图源码==百读Demo
<html> <head> </head> <body> <script type="text/javascript" src="http://api.map.baidu.com/api?v=1.3"></script> <p> <div id="container" style=" 632px; height: 422px"> </div> </p> <script type="text/javascript"> var loadMap = function () { var BaiduPoint = "MTE2LjU2MzkxNDk3NDgy,MzkuOTMxOTIzNTg3ODUy"; var map = new BMap.Map("container"); // 创建地图实例 var point = new BMap.Point(BaiduPoint.split(",")[0], BaiduPoint.split(",")[1]); // 创建点坐标 //point.lng=121.17112780236; point.lat=31.297584990778; map.enableScrollWheelZoom(); //启用滚轮放大缩小,默认禁用 map.centerAndZoom(point, 15); // 初始化地图,设置中心点坐标和地图级别 var marker = new BMap.Marker(point); // 创建标注 map.addOverlay(marker); // 将标注添加到地图中 var label = new BMap.Label("具体显示名称", { offset: new BMap.Size(20, -10) }); marker.setLabel(label); //添加百度label map.addControl(new BMap.NavigationControl()); //添加默认缩放平移控件 }; loadMap(); </script> </body> </html>
C# 转换 Base64为数字坐标。
private string EncoreBase64(string str) { if (string.IsNullOrEmpty(str)) return ""; var point = str.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); if (point.Length <= 0) return ""; double p1; if (double.TryParse(point[0], out p1)) { return str; } /*Base64解码*/ var list = new List<string>(); foreach (var item in point) { var bpath = Convert.FromBase64String(item); list.Add(ASCIIEncoding.Default.GetString(bpath)); } return string.Join(",", list.ToArray()); }