腾讯地图实时路况切片地址:
https://rtt2b.map.qq.com/rtt/?z={z}&x={x}&y={reverseY}×=1&time=’+longTime+’
高德地图实时路况切片地址:
http://tm.amap.com/trafficengine/mapabc/traffictile?v=1.0&=&=&t=1&t=’+longTime+’&x={x}&y={y}&z={z}
百度地图实时路况切片地址(无标注):
http://its.map.baidu.com:8002/traffic/TrafficTileService?level={z}&x={x}&y={y}&time=’+longTime+’$&v=081&scaler=1
注意longTime为long值的时间戳:
//获取当前时间
var nowDate = new Date();
var year = nowDate.getFullYear();
var month = nowDate.getMonth() + 1;
var today = nowDate.getDate();
var hours = nowDate.getHours();
var minutes = nowDate.getMinutes();
var seconds = nowDate.getSeconds();
if (month >= 1 && month <= 9) {
month = "0" + month;
}
if (today >= 1 && today <= 9) {
today = "0" + today;
}
var currentdate = year + "-" + month + "-" + today + " " + hours + ":" + minutes + ":" + seconds;
var longTime = new Date(currentdate.replace(new RegExp("-", "gm"), "/")).getTime();