2012-11-16 36 views
5

Tôi khá hoàn thành khi sử dụng chức năng animated update của google earth và đang sử dụng nó để di chuyển models xung quanh. Những gì tôi thực sự muốn làm là để có thể animate một line (ví dụ như lên và xuống) trong Google Earth nhưng tôi thấy việc này phức tạp.Tạo hoạt ảnh cho một đường trong Google Earth bằng cách sử dụng kml

Tôi có kinh độ và vĩ tuyến của dòng ngay từ đầu. Ví dụ tọa độ dòng là:

-88,17,100 -88.20270841086835,17.21899813162266,100

sau đó tôi muốn raise một đầu của dây chuyền này lên đến độ cao 500 trong khoảng thời gian 5 giây .

tôi đã rút ra những dòng sử dụng LineString:

<Placemark id="path1"> 
    <name>Untitled Path man</name> 
    <LineString> 
     <tessellate>1</tessellate> 
     <coordinates> 
      -88.,17,100 -88.20270841086835,17.21899813162266,100 
     </coordinates> 
    </LineString> 
</Placemark> 

Nhưng Im bây giờ bị mất như thế nào để sử dụng <gx:AnimatedUpdate> để di chuyển một đầu lên từ 100 đến 500.

Im chắc chắn của nó dễ dàng - có thể ai đó chỉ cho tôi đi đúng hướng ??

Trả lời

5

Bí quyết là cập nhật phần tử LineString (có id trên đó) thay vì Dấu vị trí.

Đây là chuyến tham quan mẫu KML đang hoạt động để làm động một dòng thay đổi từ độ cao tương đối từ 100 đến 500m.

<?xml version="1.0" encoding="UTF-8"?> 
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2"> 
    <Document> 
     <name>gx:AnimatedUpdate example</name> 
     <open>1</open> 

     <LookAt> 
      <longitude>-88.1351880996469</longitude> 
      <latitude>17.09943637744042</latitude> 
      <altitude>0</altitude> 
      <heading>49.91874373078863</heading> 
      <tilt>84.43764019949967</tilt> 
      <range>1929.311316966288</range> 
      <gx:altitudeMode>relativeToSeaFloor</gx:altitudeMode> 
     </LookAt> 

     <Placemark> 
      <name>Untitled Path man</name> 
      <LineString id="path1"> 
       <tessellate>1</tessellate> 
       <altitudeMode>relativeToGround</altitudeMode> 
       <coordinates> 
      -88,17,100 -88.20270841086835,17.21899813162266,100 
       </coordinates> 
      </LineString> 
     </Placemark> 

     <gx:Tour> 
      <name>Play me!</name> 
      <gx:Playlist> 
       <gx:AnimatedUpdate> 
        <gx:duration>5</gx:duration> 
        <Update> 
         <targetHref/> <!-- Left empty to refer to the current file --> 
         <Change>       
          <LineString targetId="path1"> 
           <coordinates> 
            -88,17,100 -88.20270841086835,17.21899813162266,500    
           </coordinates>       
          </LineString> 
         </Change> 
        </Update> 
       </gx:AnimatedUpdate> 

       <!-- Wait for the animation to complete (see the touring 
       tutorial for an explanation of how AnimatedUpdate's 
       duration isn't enough to guarantee this). --> 
       <gx:Wait> 
        <gx:duration>5.0</gx:duration> 
       </gx:Wait> 
      </gx:Playlist> 
     </gx:Tour> 
    </Document> 
</kml> 

Để biết chi tiết thấy https://developers.google.com/kml/documentation/touring#tourtimelines

+0

Câu hỏi đã trả lời, cảm ơn nhiều – user1829877

Các vấn đề liên quan