书签 分享 收藏 举报 版权申诉 / 27

类型百度地图开发说明文档.docx

  • 文档编号:16290355
  • 上传时间:2023-07-12
  • 格式:DOCX
  • 页数:27
  • 大小:1.53MB

经度:

纬度:

城市名:

100px;margin-right:

10px;"/>

请输入:

150px;"/>关键字提示

1pxsolid#C0C0C0;width:

150px;height:

auto;display:

none;">

//XX地图API功能

varmap=newBMap.Map('map');

varpoint=newBMap.Point(116.404,39.915);

map.centerAndZoom(point,10);

map.enableScrollWheelZoom(true);

map.enableInertialDragging(true);

//绘制覆盖物获取数量及清除覆盖物

varoverlays=[];

varoverlaycomplete=function(e){

overlays.push(e.overlay);

};

varstyleOptions={

strokeColor:

"red",//边线颜色。

fillColor:

"red",//填充颜色。

当参数为空时,圆形将没有填充成效。

strokeWeight:

3,//边线的宽度,以像素为单位。

strokeOpacity:

0.8,//边线透明度,取值范围0-1。

fillOpacity:

0.6,//填充的透明度,取值范围0-1。

strokeStyle:

'solid'//边线的样式,solid或dashed。

}

//实例化鼠标绘制工具

vardrawingManager=newBMapLib.DrawingManager(map,{

isOpen:

false,//是不是开启绘制模式

enableDrawingTool:

true,//是不是显示工具栏

drawingToolOptions:

{

anchor:

BMAP_ANCHOR_TOP_RIGHT,//位置

offset:

newBMap.Size(5,5),//偏离值

},

circleOptions:

styleOptions,//圆的样式

polylineOptions:

styleOptions,//线的样式

polygonOptions:

styleOptions,//多边形的样式

rectangleOptions:

styleOptions//矩形的样式

});

//添加鼠标绘制工具监听事件,用于获取绘制结果

drawingManager.addEventListener('overlaycomplete',overlaycomplete);

functionclearAll(){

for(vari=0;i

map.removeOverlay(overlays[i]);

}

overlays.length=0

}

//添加覆盖物删除覆盖物

varmarker=newBMap.Marker(newBMap.Point(116.404,39.915));//创建点

varpolyline=newBMap.Polyline([

newBMap.Point(116.399,39.910),

newBMap.Point(116.405,39.920),

newBMap.Point(116.425,39.900)

],{strokeColor:

"blue",strokeWeight:

2,strokeOpacity:

0.5});//创建折线

varcircle=newBMap.Circle(point,500,{strokeColor:

"blue",strokeWeight:

2,strokeOpacity:

0.5});//创建圆

varpolygon=newBMap.Polygon([

newBMap.Point(116.387112,39.920977),

newBMap.Point(116.385243,39.913063),

newBMap.Point(116.394226,39.917988),

newBMap.Point(116.401772,39.921364),

newBMap.Point(116.41248,39.927893)

],{strokeColor:

"blue",strokeWeight:

2,strokeOpacity:

0.5});//创建多边形

varpStart=newBMap.Point(116.392214,39.918985);

varpEnd=newBMap.Point(116.41478,39.911901);

varrectangle=newBMap.Polygon([

newBMap.Point(pStart.lng,pStart.lat),

newBMap.Point(pEnd.lng,pStart.lat),

newBMap.Point(pEnd.lng,pEnd.lat),

newBMap.Point(pStart.lng,pEnd.lat)

],{strokeColor:

"blue",strokeWeight:

2,strokeOpacity:

0.5});//创建矩形

varinfoWindow1=newBMap.InfoWindow("天安门座落在中国北京市中心,故宫的南侧,与天安门广场隔长安街相望,是清朝皇城的大门");//创建信息窗口对象

marker.addEventListener("click",function(){

this.openInfoWindow(infoWindow1);//开启信息窗口

});

//添加覆盖物

functionadd_overlay()

{

map.addOverlay(marker);//增加点

map.addOverlay(polyline);//增加折线

map.addOverlay(circle);//增加圆

map.addOverlay(polygon);//增加多边形

map.addOverlay(rectangle);//增加矩形

}

//清除覆盖物

functionremove_overlay(){

map.clearOverlays();

}

//地址解析

functiondizhijiexi()

{

vardizhi=document.getElementById("dizhi").value;

varmyGeo=newBMap.Geocoder();

//将地址解析结果显示在地图上,并调整地图视野

myGeo.getPoint(dizhi,function(point){

if

举报
举报
版权申诉
版权申诉
word格式文档无特别注明外均可编辑修改;预览文档经过压缩,下载后原文更清晰! 立即下载
配套讲稿:

如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。

特殊限制:

部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。

关 键  词:
百度 地图 开发 说明 文档
提示  冰点文库所有资源均是用户自行上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作他用。
关于本文
本文标题:百度地图开发说明文档.docx
链接地址:https://www.bingdoc.com/p-16290355.html
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2


收起
展开