自定义定位点图标

html,body,#container{

height:100%;

}

//初始化地图对象,加载地图

var map = new AMap.Map('container', {

resizeEnable: true

});

var options = {

'showButton': true,//是否显示定位按钮

'buttonPosition': 'LB',//定位按钮的位置

/* LT LB RT RB */

'buttonOffset': new AMap.Pixel(10, 20),//定位按钮距离对应角落的距离

'showMarker': true,//是否显示定位点

'markerOptions':{//自定义定位点样式,同Marker的Options

'offset': new AMap.Pixel(-18, -36),

'content':'7eb2ddd81d1acce2827df275ef991825.png'

},

'showCircle': true,//是否显示定位精度圈

'circleOptions': {//定位精度圈的样式

'strokeColor': '#0093FF',

'noSelect': true,

'strokeOpacity': 0.5,

'strokeWeight': 1,

'fillColor': '#02B0FF',

'fillOpacity': 0.25

}

}

AMap.plugin(["AMap.Geolocation"], function() {

var geolocation = new AMap.Geolocation(options);

map.addControl(geolocation);

geolocation.getCurrentPosition()

});

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐