76百度地图:经纬度

很多场合都用到百度地图,这里是笔者把自己老家县政府的位置(经纬度)和老家住宅的位置(经纬度)在百度地图上标出来。
```html:run
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<title>固始县政府</title>
<style type="text/css">
body, html,#onlymap{width: 100%;height: 100%; margin:0;font-family:"微软雅黑";}
</style>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=vvNvGRSQV4QdtGZaoKDB04yW5mFBrFSX"></script>
</head>
<body>
<div id="onlymap"></div>
</body>
</html>
<script type="text/javascript">
//整体设置
var map = new BMap.Map("onlymap");
map.centerAndZoom(new BMap.Point(115.6608, 31.7575), 10);
map.enableScrollWheelZoom();
//笔者所在县=>固始县县政府位置
var countyGovernmentPoint = new BMap.Point(115.6608, 32.1749);
var countyGovernmentmarker = new BMap.Marker(countyGovernmentPoint);
map.addOverlay(countyGovernmentmarker);
var countyGovernmentPosition = countyGovernmentmarker.getPosition();
var countyGovernmentPositionLng=countyGovernmentPosition.lng;
var countyGovernmentPositionLat=countyGovernmentPosition.lat;
var countyGovernmentLabel = new BMap.Label("笔者所在县=>固始县县政府位置:<br/>东经"+countyGovernmentPositionLng+"度,北纬"+countyGovernmentPositionLat+"度",{offset:new BMap.Size(-105,37)});
countyGovernmentmarker.setLabel(countyGovernmentLabel);
var circle = new BMap.Circle(countyGovernmentPoint,500,{strokeColor:"red", strokeWeight:5, strokeOpacity:0.5});
map.addOverlay(circle);
//笔者老家住宅=>位置
var myFamilypoint = new BMap.Point(115.7097, 31.9053);
var myFamilymarker = new BMap.Marker(myFamilypoint);
map.addOverlay(myFamilymarker);
var myFamilyPosition = myFamilymarker.getPosition();
var myFamilyPositionLng=myFamilyPosition.lng;
var myFamilyPositionLat=myFamilyPosition.lat;
var myFamilyLabel = new BMap.Label("笔者老家住宅=>位置:<br/>东经"+myFamilyPositionLng+"度,北纬"+myFamilyPositionLat+"度",{offset:new BMap.Size(-75,28)});
myFamilymarker.setLabel(myFamilyLabel);
//左上角添加默认缩放平移控件
var topLeftNavigation = new BMap.NavigationControl();
map.addControl(topLeftNavigation);
</script>
```

转载于:https://www.cnblogs.com/gushixianqiancheng/p/10967063.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值