| | |
| | | //保存定位坐标生成轨迹 |
| | | var path=[]; |
| | | var lineLayer = new T.Polyline([], { color: '#ff4500', weight: 3, opacity: 0.8 }); |
| | | |
| | | let locationMarker; |
| | | function updateLocation(log,lat){ |
| | | var lastLat=lat; |
| | | // const intervalId = setInterval(() => { |
| | |
| | | path.push(newPoint); |
| | | lineLayer.setLngLats(path); |
| | | map.addOverLay(lineLayer); |
| | | let icon = new T.Icon({ |
| | | iconUrl: locationIMGPath, |
| | | iconSize: new T.Point(27, 27), |
| | | iconAnchor: new T.Point(13, 20) |
| | | }); |
| | | if (locationMarker) { |
| | | map.removeOverLay(locationMarker); |
| | | } |
| | | locationMarker = new T.Marker(new T.LngLat(log, lastLat), { icon: icon }); |
| | | map.addOverLay(locationMarker); |
| | | // 移动地图视角到最后一个位置 |
| | | map.panTo(newPoint); |
| | | // }, 500); |
| | |
| | | |
| | | |
| | | })(); |
| | | |