<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<meta name= "viewport" content= "initial-scale=1.0, User-scalable=no"/>
<style type= "Text/css" >
Body, HTML, #allmap {width:100%;height:95%;overflow:hidden;margin:0;font-family: "Microsoft Jas Black";}
</style>
<script type= "Text/javascript" src= "Http://api.map.baidu.com/api?v=2.0&ak=zfTIKtNx9zBgxLIwpAOt28dE" > </script>
<script type= "Text/javascript" src= "http://api.map.baidu.com/library/SearchInfoWindow/1.5/src/ Searchinfowindow_min.js "></script>
<link rel= "stylesheet" href= "Http://api.map.baidu.com/library/SearchInfoWindow/1.5/src/SearchInfoWindow_min.css"/>
<title> Navigate to Destination </title>
<body>
<div id= "Allmap" ></div>
<center><div><input id= "keyword" type= "text"/>
<%--<input type= "text" id= "Jingweidu"/>
--%><input type= "button" value= "Search" onclick= "searchbystationname ();" /></div></center>
</body>
<script type= "Text/javascript" >
var map = new Bmap.map ("Allmap");
var geolocation = new Bmap.geolocation ();
Geolocation.getcurrentposition (function (r) {
if (this.getstatus () = = bmap_status_success) {
var mk = new Bmap.marker (r.point);
Map.addoverlay (MK);
Map.centerandzoom (New Bmap.point (R.POINT.LNG, R.point.lat), 11);
Map.panto (R.point);
}
else {
Alert (' Failed ' +this.getstatus ());
}
},{enablehighaccuracy:true})
var localsearch = new Bmap.localsearch (map);
Localsearch.enableautoviewport (); Allow automatic resizing of forms
function Searchbystationname () {
Map.clearoverlays ();//Clear the original label
var keyword = document.getElementById ("keyword"). value;
Localsearch.setsearchcompletecallback (function (SearchResult) {
var poi = searchresult.getpoi (0);
document.getElementById ("Jingweidu"). Value = Poi.point.lng + "," + Poi.point.lat;
Map.centerandzoom (Poi.point, 13);
Map.enablescrollwheelzoom ();
var content = "Longitude:" + poi.point.lng + "<br/> Latitude:" + Poi.point.lat;
var marker = new Bmap.marker (new Bmap.point (POI.POINT.LNG, Poi.point.lat)); Create a callout that corresponds to the latitude and longitude of the place to be queried
Map.addoverlay (marker);
Marker.setanimation (bmap_animation_bounce); Bouncing animations
Marker.addeventlistener ("click", Function (e) {
Searchinfowindow.open (marker);
})
Create a Retrieve Information window object
var searchinfowindow = null;
Searchinfowindow = new Bmaplib.searchinfowindow (map, content, {
Title:keyword,//title
width:290,//width
height:105,//height
Panel: "Panel",//Search results panel
Enableautopan:true,//auto-pan
Searchtypes: [
Bmaplib_tab_search,//around search
Bmaplib_tab_to_here,//GO here
Bmaplib_tab_from_here//Depart from here
]
});
});
Localsearch.search (keyword);
}
</script><%--
var GEOC = new Bmap.geocoder ();
Map.addeventlistener ("click", Function (e) {
var pt = E.point;
Geoc.getlocation (PT, function (RS) {
var addcomp = rs.addresscomponents;
var url= "http://api.map.baidu.com/marker?location=" +r.point.lat+ ","
+r.point.lng+ "&title= Target location &content=" +addcomp.province + addcomp.city + addcomp.district + addComp.street + addcomp.streetnumber+ "&output=html";
window.location.href = URL;
});
});
--%>
Baidu Map search places to navigate