高德地图有两个key 一个web一个js 要用js的key
1:显示地图
map = new AMap.Map('map', {
resizeEnable: true,
zoom: 14,
center: [east, north] //坐标
});
map.plugin(["AMap.ToolBar"], function() {
map.addControl(new AMap.ToolBar({
offset: new AMap.Pixel(20, 45),
position: "RT"
}));
});
2 显示标注
marker = new AMap.Marker({
map: map,
position: [east, north],
icon: new AMap.Icon({
size: new AMap.Size(40, 50), //图标大小
image: imgurl, //图标地址
imageOffset: new AMap.Pixel(0, 0) //偏移
})
});
markers.push(marker); //为删除所有点做准备
AMap.event.addListener(marker, 'mouseover', function () { //鼠标移动元素正上方触发
});
3 删除标注
map.remove(markers); //删除记录的markers
map.remove(markers); //删除单个marker
4 逆向地址
//&plugin=AMap.Geocoder 必须在<script>加上
var geocoder = new AMap.Geocoder({
radius: 1000,
extensions: "all"
});
geocoder.getAddress([obj.gdeast, obj.gdnorth], function (status, result) {
geocoder_CallBack_openInfo(result); //result.regeocode.formttedAddress 地址完整描述
});
5 轨迹回放 高德有自己的轨迹回放例子 贴个地址
http://lbs.amap.com/api/javascript-api/example/marker/replaying-historical-running-data/