2015-08-18 27 views
0

我已经有一些代码来生成2D KML文件,但我感兴趣的再现图像与此类似,与相关的深度分布到每个位置:产3D跟踪谷歌地球KML文件

enter image description here

是否有一个很好的参考(或者可能是python库)?我还没有设法找到任何东西。

图片编号: Baird,R.W.,S.W.马丁,D.L.韦伯斯特和B.L.索撒尔。 2014年。在太平洋导弹射程设施中暴露于中频活跃声纳的卫星标记的牙齿齿轮的建模接收声压级和运动评估:2011年2月至2013年2月。为美国太平洋舰队编写,由HDR Environmental提交给NAVFAC PAC, Operations and Construction,Inc.

回答

1

您可以使用其他语言来产生像在下面的链接某些KML文件:

https://sites.google.com/site/canadadennischen888/home/kml/3d-tracking

  • 点击下载附件中的文件
  • 选择“另存为”看到KML内容
  • 选择“打开”,看看导致谷歌地球

希望这有助于

+0

太好了。我想这就是我需要的。当我回到这里时,我会尝试发布我的python解决方案。谢谢丹尼斯! – ryanjdillon

1

如果您使用的是java,我有代码可以生成kml以显示Google地球中的3D跟踪。 (加上,每个点从空气到地面的垂直线)。 (假设:既然你有2D代码,你可能已经有了从kml21.xsd转换来的java pojo代码。) (ps我可以给你附上一张图片,如果你知道任何免费的网站可以上传图片。) Hope此帮助:

package com.googleearth.util; 

import java.util.List; 

import javax.xml.bind.JAXBElement; 

import com.a.googleearth.entities.GoogleEarthView; 
import com.a.googleearth.model.AltitudeModeEnum; 
import com.a.googleearth.model.DocumentType; 
import com.a.googleearth.model.FolderType; 
import com.a.googleearth.model.KmlType; 
import com.a.googleearth.model.LineStringType; 
import com.a.googleearth.model.LineStyleType; 
import com.a.googleearth.model.ObjectFactory; 
import com.a.googleearth.model.PlacemarkType; 
import com.a.googleearth.model.StyleType; 

public class KmlService { 

    public static final byte[] blue = new byte[]{(byte)0x64,(byte)0xF0,(byte)0x00,(byte)0xFF}; 

    private static ObjectFactory factory = new ObjectFactory(); 

    static final String DEFAULT_REGISTRATION_FOR_EMPTY = "EMPTY"; 

    public static JAXBElement<KmlType> createKml(List<GoogleEarthView> listGoogleEarthDBView) { 

     KmlType kml = factory.createKmlType(); 

     DocumentType document = factory.createDocumentType(); 
     kml.setFeature(factory.createDocument(document)); 

     { 
      LineStyleType redLineStyle = factory.createLineStyleType(); 
      // http://www.zonums.com/gmaps/kml_color/ 
      redLineStyle.setColor(new byte[]{(byte)0xFF,(byte)0xF0,(byte)0x00,(byte)0x14}); 
      redLineStyle.setWidth(5f); 

      StyleType style = factory.createStyleType(); 
      style.setId("blueLine"); 
      style.setLineStyle(redLineStyle); 
      document.getStyleSelector().add(factory.createStyle(style)); 
     } 

     FolderType folder = factory.createFolderType(); 

     folder.setName(listGoogleEarthDBView.get(0).getFolderName()); 

     document.getFeature().add(factory.createFolder(folder)); 

     PlacemarkType currentPlacemark = null; 

     for (GoogleEarthView view : listGoogleEarthDBView) { 

      if (currentPlacemark == null || currentPlacemark.getName().equalsIgnoreCase("F0001") == false) { 

        if (currentPlacemark != null) { 
         JAXBElement<LineStringType> lineString = (JAXBElement<LineStringType>) currentPlacemark.getGeometry(); 
         lineString.getValue().getCoordinates().add(view.getLongitude() + "," + view.getLatitude() + "," + view.getPressureAltitude()+"\n"); 
        } 

        currentPlacemark = createF0001Placemark(); 
        folder.getFeature().add(factory.createPlacemark(currentPlacemark)); 
       } 

       JAXBElement<LineStringType> lineString = (JAXBElement<LineStringType>) currentPlacemark.getGeometry(); 
       lineString.getValue().getCoordinates().add(view.getLongitude() + "," + view.getLatitude() + "," + view.getPressureAltitude()+"\n"); 

     } 

     JAXBElement<KmlType> kmlElement = factory.createKml(kml); 

     return kmlElement; 
    } 

    private static PlacemarkType createF0001Placemark() { 
     PlacemarkType placeMark = factory.createPlacemarkType(); 
     placeMark.setName("F0001"); 

     placeMark.setStyleUrl("#blueLine"); 

     LineStringType flyhtStreamLineString = factory.createLineStringType(); 
     flyhtStreamLineString.setAltitudeMode(AltitudeModeEnum.ABSOLUTE); 
     flyhtStreamLineString.setExtrude(Boolean.TRUE); 
     placeMark.setGeometry(factory.createLineString(flyhtStreamLineString)); 
     return placeMark; 
    } 


} 
+0

我不知道关于Java。我会尽快回到这个项目。我会把这个打开,直到我明白为止。谢谢! – ryanjdillon