轨迹与地图不匹配
因字数过多删去了大部分经纬度数据
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
body, html,#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;}
</style>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=jipmCMz1Z97ATa396MynmctMWvfl8ObL"></script>
<title>route</title>
</head>
<body>
<div id="allmap"></div>
</body>
</html>
<script type="text/javascript">
var map = new BMap.Map("allmap");
var point = new BMap.Point(113.90420611869588 , 22.476210155377533);
map.centerAndZoom(point, 15);
var polyline = new BMap.Polyline([
new BMap.Point( 113.90420611869588 , 22.476210155377533 ),
new BMap.Point( 113.90420611869588 , 22.476210155377533 ),
new BMap.Point( 113.90420611869588 , 22.476210155377533 ),
new BMap.Point( 113.90420611869588 , 22.476210155377533 ),
new BMap.Point( 113.90420611869588 , 22.476210155377533 ),
new BMap.Point( 113.90420611869588 , 22.476210155377533 ),
new BMap.Point( 113.90420611869588 , 22.476210155377533 ),
new BMap.Point( 113.90420611869588 , 22.476210155377533 ),
new BMap.Point( 113.90420611869588 , 22.476210155377533 ),
new BMap.Point( 113.90420611869588 , 22.476210155377533 )
], {strokeColor:"blue", strokeWeight:6, strokeOpacity:0.5});
map.addOverlay(polyline);
</script>
正常的轨迹图:
运行出来的轨迹图:
希望能使轨迹不漂移
你的经纬度是不是WGS84的,百度的坐标系是BD09,在GCJ02坐标系基础上再次加密的。这两个坐标系不一样,得到的经纬度也是不一样的,你应该把你的经纬度转换成百度坐标系的经纬度,然后再展示