2010-03-04 5 views
0

Google 어스에서 건물을 만들 수 있는지 궁금합니다. 그 내 웹 서버와 정보를 교환합니다. 그래서 나는 그것을 변경할 수 있습니다. 웹 서버에서 말하는 벽 컬러, 또는 서비스가 매분 새로운 값을 보냅니다. 감사합니다.대화 형 Google Earth 건물

답변

0

예, 3D 개체를 만들어 Google 어스에로드 한 다음 속성을 조정할 수 있습니다. 이 작업을 수행하는 한 가지 방법은 필요한 모델 데이터를로드하는 NetWorkLink 파일을 사용하는 것입니다. NetWorkLink를 다양한 기준에 따라 새로 고치도록 설정할 수 있으며 herf 속성에 CGI 스크립트를 지정할 수 있습니다. pesudo 예제는 이와 같이 작동합니다.

1) KML

<?xml version="1.0" encoding="UTF-8"?> 
<kml xmlns="http://www.opengis.net/kml/2.2"> 
    <NetworkLink> 
     <refreshVisibility>0</refreshVisibility> 
     <flyToView>1</flyToView> 
     <Link> 
     <refreshInterval>2</refreshInterval> 
     <viewRefreshMode>onStop</viewRefreshMode> 
     <viewRefreshTime>1</viewRefreshTime> 
     <href>http://yourserver.com/cgi-bin/loadbuilding.php</href> 
     </Link> 
    </NetworkLink> 
</kml> 

2) herf 지정된 CGI 스크립트에서 정의 된 네트워크 링크

<?php 
    // some logic to select a particular kmz file etc 
    $fullPath = "path to your file"; 

    if ($fd = fopen ($fullPath, "r")) { 
    header("Content-type: application/octet-stream"); 
    header("Content-Disposition: filename=building.kmz"); 
    header("Content-Type: application/vnd.google-earth.kml+xml\n"); 
    while(!feof($fd)) { 
     $buffer = fread($fd, 2048); 
     echo $buffer; 
    } 
    fclose ($fd); 
    exit; 
    } 
    ?>