baidu地图API中怎么得到目标点的具体信息

baidu地图API中怎么得到目标点的具体信息,第1张

给分吧,写了两个小时……
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 10 Transitional//EN" "http://wwww3org/TR/xhtml1/DTD/xhtml1-transitionaldtd">
<html xmlns="http://wwww3org/1999/xhtml">
<head>
<title>百度地图-应用Demo</title>
<script src="/Static/common/js/jquery-144js" type="text/javascript"></script>
<script src="/Static/common/js/Corejs" type="text/javascript"></script>
<link href="/Static/common/css/Smoothness/stylecss" rel="stylesheet" type="text/css" />
<script src="/Static/common/js/jquery-ui-187minjs" type="text/javascript"></script>
<script type="text/javascript" src="http://apimapbaiducom/apikey=51e98f02065e0e922e0ca62228018206&v=11&services=true"></script>
<style type="text/css">

{
margin: 0px;
padding: 0px;
}

a
{
text-decoration:none;
}

a:hover
{
color:#FF0000;
}

body
{
font-size: 12px;
font-family: "Microsoft YaHei";
}
clr
{
clear:both;
}

#tabs label
{
width: 80px;
float: left;
}

menu div
{
margin-bottom: 8px;
}

#topMenu ul
{
list-style-type: none;
}
#topMenu ul li
{
float: left;
width: 80px;
text-align: center;
}

#headerBar
{
width: 100%; height: 35px; line-height: 35px;padding-left: 10px;
}

#headerBar div
{
float: left; text-align: center;
}

#content
{
margin: 0 auto; width: 1003px;
}

#mapContainer
{
width: 600px; height: 550px; border: #ccc solid 1px;float: left;
}

#mapControl
{
float: left; margin-left: 5px;
}

#tabs
{
width: 300px; margin-bottom: 3px;
}

#tabs menuButton
{
text-align:right;
}

#mapResults
{
width: 306px; margin: 0px; padding: 0px; margin-left: 1px;
}

#footerBar
{
width: 1003px; margin: 0px auto; text-align: center; border-top: 1px dashed #b8b8b8;color: #b8b8b8; margin-top: 15px;"
}
</style>
</head>
<body>
<!-- 页头 -->
<div id="headerBar" class="ui-widget-header">
<div id="logo">
DotnetApicom </div>
<div id="switchCity" >
</div>
<div id="topMenu">
<ul>
<li><a href="#">首页</a></li>
<li><a href="BMaphtm">地图Demo</a></li>
</ul>
</div>
</div>
<!-- 内容 -->
<div id="content">
<!--百度地图容器-->
<div id="mapContainer">
</div>
<div id="mapControl">
<div id="tabs">
<ul>
<li><a href="#tabs-1">本地</a></li>
<li><a href="#tabs-2">公交</a></li>
<li><a href="#tabs-3">驾车</a></li>
</ul>
<div id="tabs-1" class="menu">
<div>
<label for="iptSearchFor">
搜索地点:</label>
<input id="txtSearchFor" name="searchFor" type="text" value="中关村" />
</div>
<div>
<label for="iptSearchFor">
在周围搜索:</label>
<input id="txtSearchNearby" type="text" value="小吃" /><br />
</div>
<div class="menuButton">
<input id="btnSearchFor" type="button" value="搜索" />
</div>
</div>
<div id="tabs-2" class="menu">
<div>
<label for="txtTransitStart">
起点:</label>
<input id="txtTransitStart" name="searchFor" type="text" value="北京站" />
</div>
<div>
<label for="txtTransitEnd">
终点:</label>
<input id="txtTransitEnd" type="text" value="西二旗" /><br />
</div>
<div class="menuButton">
<input id="btnSearchTransit" type="button" value="搜索" />
</div>
</div>
<div id="tabs-3" class="menu">
<div>
<label for="txtDrivingStart">
起点:</label>
<input id="txtDrivingStart" type="text" value="北京站" />
</div>
<div>
<label for="txtDrivingEnd">
终点:</label>
<input id="txtDrivingEnd" type="text" value="西二旗" /><br />
</div>
<div class="menuButton">
<input id="btnSearchDriving" type="button" value="搜索" />
</div>
</div>
</div>
<div id="mapResults" >
</div>
</div>
</div>
<div class="clr"></div>
<!-- 页脚 -->
<div id="footerBar">
copyright © 1999-2010 DotnetApicom All Rights Reserved
</div>
<script type="text/javascript">
var ThisPage = {
initialize: function ()
{
/// <summary>
/// 初始化
/// </summary>
$("#tabs")tabs();
$("#btnSearchFor, #btnSearchTransit, #btnSearchDriving")button();
thismap = new BMapMap("mapContainer");
var point = new BMapPoint(116404, 39915);
thismapcenterAndZoom(point, 14);
thismapaddControl(new BMapNavigationControl());
thismapaddControl(new BMapScaleControl());
thismapaddControl(new BMapOverviewMapControl());
},
initializeEvent: function ()
{
$("#btnSearchFor")click(function (e)
{
var searchFor = $("#txtSearchFor")val();
var searchNearby = $("#txtSearchNearby")val();
if (searchFor && !searchNearby)
{
thislocal = new windowBMapLocalSearch(thismap, {
renderOptions: { map: thismap, panel: "mapResults" }
});
thismapclearOverlays();
thislocalsearch(searchFor);
}
else (searchFor && searchNearby)
{
thislocal = new windowBMapLocalSearch(thismap, {
renderOptions: { map: thismap, autoViewport: false, selectFirstResult: false },
pageCapacity: 1
});
thismapclearOverlays();
thislocalsetSearchCompleteCallback(thisonSearchCompleteproxy(this));
thislocalsearch(searchFor);
}
} proxy(this));
$("#btnSearchTransit")click(function (e)
{
var transitStart = $("#txtTransitStart")val();
var transitEnd = $("#txtTransitEnd")val();
if (transitStart && transitEnd)
{
var transit = new windowBMapTransitRoute(thismap, {
renderOptions: { map: thismap, panel: "mapResults", autoViewport: true }
});
thismapclearOverlays();
transitsearch(transitStart, transitEnd);
}
} proxy(this));
$("#btnSearchDriving")click(function (e)
{
var drivingStart = $("#txtDrivingStart")val();
var drivingEnd = $("#txtDrivingEnd")val();
if (drivingStart && drivingEnd)
{
var driving = new windowBMapDrivingRoute(thismap, {
renderOptions: { map: thismap, panel: "mapResults", autoViewport: true }
});
thismapclearOverlays();
drivingsearch(drivingStart, drivingEnd);
}
} proxy(this));
},
onSearchComplete : function (results)
{
if (thislocalgetStatus() == BMAP_STATUS_SUCCESS)
{
var count = resultsgetCurrentNumPois();
if (count > 0)
{
var point = resultsgetPoi(0)point;
thismapcenterAndZoom(point, 16);
var local = new BMapLocalSearch(thismap, {
renderOptions: { map: thismap, selectFirstResult: false, panel: "mapResults" },
pageCapacity: 20
});
thismapclearOverlays();
localsearchInBounds($("#txtSearchNearby")val(), thismapgetBounds());
}
}
}
};
$(function ()
{
var thisPage = Classcreate(ThisPage)
});
</script>
</body>
</html>

以上就是关于baidu地图API中怎么得到目标点的具体信息全部的内容,包括:baidu地图API中怎么得到目标点的具体信息、、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/10072371.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-04
下一篇 2023-05-04

发表评论

登录后才能评论

评论列表(0条)

保存