uniapp怎么实现轨迹显示?

uniapp怎么实现轨迹显示?

问题描述:

想用uniapp做车辆的行驶轨迹回显,使用map的polyline属性来做连线,根据n条经纬度连接实现轨迹显示。但是地图显示都是错乱的

<map id="maps" :latitude="latitude" :longitude="longitude" :markers="markers" :polyline="polylines" scale="10"></map>

res.data是调用接口返回的经度和纬度集合,需要根据res.data返回的上万条经纬度进行连线形成轨迹图

图片说明

selectMap(data).then(res => {
                    if (res.success) {
                        const that = this;
                        that.polylines=[{
                            points:res.data,
                            width: 2,
                            color: "0000CC"
                        }];
                        uni.showToast({
                            icon: 'none',
                            title: "获取位置成功"
                        });
                    } else {
                        uni.showToast({
                            icon: 'none',
                            title: res.msg
                        });
                    }
                })
            },


![图片说明](https://img-ask.****.net/upload/202001/05/1578200606_624225.png)