1%s <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=%s"></script> %s 2<style type="text/css">#%s {width: %s;height: %s;overflow: hidden;margin:0;}</style> 3<div id="%s"></div> 4<script type="text/javascript"> 5function showMap%s() 6{ 7 var pnt = gcj02_to_bd09(%f,%f); 8 var map = new BMap.Map("%s"); 9 map.centerAndZoom(new BMap.Point(pnt.lng, pnt.lat), %d); 10 map.enableScrollWheelZoom(true); 11 12 if(%s) 13 { 14 var point = new BMap.Point(pnt.lng, pnt.lat); 15 var marker = new BMap.Marker(point); 16 marker.setTitle("%s"); 17 map.addOverlay(marker); 18 19 marker.addEventListener("click", function(){ 20 var mp = marker.getPosition(); 21 var navi_url = "http://api.map.baidu.com/marker?location="+mp.lat+","+mp.lng+"&title="+encodeURIComponent(marker.getTitle())+"&content="+encodeURIComponent(marker.getTitle())+"&output=html&src=webapp.baidu.openAPIdemo"; 22 window.open(navi_url); 23 }); 24 } 25 26 if(%s) 27 { 28 map.setMapType(BMAP_HYBRID_MAP); 29 } 30} 31showMap%s(); 32 33function gcj02_to_bd09(lng, lat) { 34 var z = Math.sqrt(lng * lng + lat * lat) + 0.00002 * Math.sin(lat * Math.PI); 35 var theta = Math.atan2(lat, lng) + 0.000003 * Math.cos(lng * Math.PI); 36 return { lng: z * Math.cos(theta) + 0.0065, lat: z * Math.sin(theta) + 0.006 }; 37} 38</script> 39 40