phpstudy|php 调用goolge地图代码

更新时间:2016-01-24    来源:php常用代码    手机版     字体:

【www.bbyears.com--php常用代码】

 require("path.inc.php");
 header("content-Type: text/html; charset=utf-8");
 $borough_id = intval($_GET["id"]);
 if(!$borough_id){
  echo "
  <script>
   parent.document.getElementById("mapDiv").style.display="none";
      parent.document.getElementById("mapDivLink").style.display="none";
    </script>
  ";
  exit;
 }
 $borough = new Borough($query);
 $boroughInfo = $borough->getInfo($borough_id,"*",1,true);
 //charsetIconv($boroughInfo,"gbk","utf-8");
 $pos = strpos($boroughInfo["borough_name"],"(");
 if($pos!==false){  
  $boroughInfo["borough_name"] = substr($boroughInfo["borough_name"],0,$pos);
 }
 
 $boroughInfo["borough_address"] = iconv("gb2312","utf-8",$boroughInfo["borough_address"]);
 $boroughInfo["borough_name"] = iconv("gb2312","utf-8",$boroughInfo["borough_name"]);
 
 $pos = strpos($boroughInfo["borough_name"],"(");
 if($pos!==false){  
  $boroughInfo["borough_name"] = substr($boroughInfo["borough_name"],0,$pos);
 }
 if(strpos($boroughInfo["borough_name"],"福州")===false){
  $boroughInfo["borough_name"] = "福州".$boroughInfo["borough_name"];
 }
?>


 
   
    小区地图
    <script src="" type="text/javascript"></script>
    <script src="http://ditu.google.com/maps?file=api&v=2.x&key=ABQIAAAAHhTjWVGPsP7PRmx_R_91ZRTVyAFvJakBKxQFkhQ3JHiKjMJ6fhSBvkRl-6priBh_xdqXZcn6jaYGDw&hl=zh-CN" type="text/javascript"></script>
    <script src="http://www.google.com/uds/api?file=uds.js&v=1.0" type="text/javascript"></script>
   
    <script type="text/javascript">
    var map = null;
    var geocoder = null;
  document.domain="fangke.cc";
    function initialize() {
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map_canvas"));
        //map.setCenter(new GLatLng(39.917, 116.397), 13);
        geocoder = new GClientGeocoder();
        map.addControl(new GLargeMapControl());
          //map.addControl(new GMapTypeControl());
      }
    }

    function showAddress(address) {
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
             parent.document.getElementById("mapDiv").style.display="none";
             parent.document.getElementById("mapDivLink").style.display="none";
            } else {
             $.post("ajax.php", { point: point,action:"point", id: "" } ,function(data){
               //alert(data);
              });
             
              map.setCenter(point, 13);
              var marker = new GMarker(point);
              map.addOverlay(marker);
              marker.openInfoWindowHtml(address+"

sale.php?id=" style="font-size:12px; color:#f90; line-height:150%;" target="_blank">二手房源:
rent.php?id=" style="font-size:12px; color:#f90; line-height:150%;" target="_blank">出租房源:套");
            }
          }
        );
      }
    }
    function setPoint(point){//php教程
   eval("var latlng = new GLatLng"+point+";");
   map.setCenter(latlng, 13);
   var marker = new GMarker(latlng);
   map.addOverlay(marker);
   marker.openInfoWindowHtml("g-.html" style="font-size:14px; color:#000; line-height:150%;" target="_blank">

sale.php?id=" style="font-size:12px; color:#f90; line-height:150%;" target="_blank">二手房源:
rent.php?id=" style="font-size:12px; color:#f90; line-height:150%;" target="_blank">出租房源:套");
    }
    </script>
 

 
     
 
  <script type="text/javascript">
   initialize();
   
     setPoint("");
   
     showAddress("");
   
  </script>

本文来源:http://www.bbyears.com/jiaocheng/21201.html

猜你感兴趣

热门标签

更多>>

本类排行