1. Determine the initial map by province + City + counties
Map.centerandzoom (Prv+city+dis, 15);
2. Initialize map with exact address
function Searchonmap (detail) { if(detail! = "") {varnew Bmap.localsearch (map, { renderoptions:{map:map} }); Alert (detail) local.search (detail); } } // Initialize map map.centerandzoom (Prv+city+dis),searchonmap (detail), Chaoyang District, Beijing, No. 21st//xx Road
Results: a.xx road 21st was searched and marked out. No. 21st B.xx Road No search, show zoom range C. Search only XX road, display multiple labels.
3. Via Address dot
varMygeo =NewBmap.geocoder (); //displays address resolution results on the map and adjusts the map viewMygeo.getpoint (Detail,function(point) {if(point) {map.centerandzoom (point,18); //If there is an address at zoom before the call expires varMyicon =NewBmap.icon ("Http://developer.baidu.com/map/jsdemo/img/fox.gif",NewBmap.size (300,157)); varMarker2 =NewBmap.marker (Point,{icon:myicon});//Create a calloutMap.addoverlay (MARKER2);//add a callout to a map }Else{alert ("The address you chose did not resolve to the result!"); return NULL; }}, city);
Results: a.xx road 21st was searched and marked out. No. 21st B.xx Road No search, the label is displayed on the road C. Search only XX Road, the callout is displayed on the road.
Baidu Map using Notes