小伙伴应该都想知道经纬度 转百度地图和百度地图经纬度查询一些这样的话题,接下来让小编给大家讲解一下关于经纬度 转百度地图的题。

经纬度 转百度地图

1.一开始的时候登记百度地形图开放账号

  登记完以后可以变成本人的密钥

  页面中引进百度地形图js文件

  >

<html lang=&34;>

<meta charset=&34;>

<meta name=&34; content=&34;>

<title>百度地形图API</title>

<script type=&34; src=&34;allmap&34;width: 800px;height: 500px;&34;r-result&34;text&34;suggestId&34;20&34;百度&34;width:150px;&34;searchResultPanel&34;border:1px solid 34;></div>

</body>

</html>

<script type=&34;>

// 百度地形图API功效

function G(id)

var map = new BMap.Map(&34;);

map.enableScrollWheelZoom(); //启用滚轮扩大减小,默许禁用

map.enableContinuousZoom(); //启用地形图惯性拖拽,默许禁用

var myDrag = new BMapLib.RectangleZoom(map, );

myDrag.open(); //开启拉框扩大

// myDrag.close(); //封闭拉框扩大

map.centerAndZoom(&34;,19); // 初始化地形图,设定都市和地形图级别呢。

var ac = new BMap.Autocomplete( //建设1个自行实现的对象

);

ac.addEventListener(&34;, function(e)

str = &34; + e.fromitem.index + &34; + value;

value = &34;;

if (e.toitem.index > -1)

str += &34; + e.toitem.index + &34; + value;

G(&34;).innerHTML = str;

);

var myValue;

ac.addEventListener(&34;, function(e) );

function setPlace()

var local = new BMap.LocalSearch(map, );

local.search(myValue);

</script>

3-2.依据经纬度定位

<啦!DOCTYPE html>

<html lang=&34;>

<meta charset=&34;>

<meta name=&34; content=&34;>

<title>百度地形图API</title>

<script type=&34; src=&34;allmap&34;width: 80%;height: 80%;&34;r-result&34;longitude&34;text&34;width:100px; margin-right:10px;&34;latitude&34;text&34;width:100px; margin-right:10px;&34;button&34;查询&34;theLocation()&34;text/javascript&34;allmap");

map.centerAndZoom(new BMap.Point(116.331398,39.897445),19);

map.enableScrollWheelZoom(true);

// 用经纬度设定地形图中心点

function theLocation()

</script>

关于经纬度 转百度地图的话题,和一些百度地图经纬度查询相关题,解完毕,希望帮助到大家。


发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。