2013-05-16 35 views
0

我一直在玩Android上的Google「My Tracks」,並將曲目導入Google Earth。當我這樣做的時候,我會得到頂部的時間欄,軌道會在你開車的時候播放,就像你的軌道動畫一樣。我想刪除該曲目的時間方面以及您在該曲目期間製作的點的時間方面。從kml文件中刪除<where> timestamp元素Google我的足跡

我進入KML文件,看到每個點都有時間戳。我一直在試圖消除負責首先使用的實際軌道的時間方面的元素:

xmlstarlet ed -d "kml/Document/Placemark/gx:MultiTrack/gx:Track/when" text.kml 

至於我假設的過程是相似的,如果我能得到固定的語法正確的地標。任何幫助將不勝感激。

Kml結構如下所示,元素是我想要移除的元素,並不完全確定Google地球是否會在那裏沒有元素,或者只是空白。

xmlstarlet el -u text.kml 

kml 
kml/Document 
kml/Document/Folder 
kml/Document/Folder/Placemark 
kml/Document/Folder/Placemark/Point 
kml/Document/Folder/Placemark/Point/coordinates 
kml/Document/Folder/Placemark/TimeStamp 
kml/Document/Folder/Placemark/TimeStamp/when 
kml/Document/Folder/Placemark/description 
kml/Document/Folder/Placemark/name 
kml/Document/Folder/Placemark/styleUrl 
kml/Document/Folder/name 
kml/Document/Folder/open 
kml/Document/Placemark 
kml/Document/Placemark/ExtendedData 
kml/Document/Placemark/ExtendedData/Data 
kml/Document/Placemark/ExtendedData/Data/value 
kml/Document/Placemark/Point 
kml/Document/Placemark/Point/coordinates 
kml/Document/Placemark/TimeStamp 
kml/Document/Placemark/TimeStamp/when 
kml/Document/Placemark/description 
kml/Document/Placemark/gx:MultiTrack 
kml/Document/Placemark/gx:MultiTrack/altitudeMode 
kml/Document/Placemark/gx:MultiTrack/gx:Track 
kml/Document/Placemark/gx:MultiTrack/gx:Track/ExtendedData 
kml/Document/Placemark/gx:MultiTrack/gx:Track/ExtendedData/SchemaData 
kml/Document/Placemark/gx:MultiTrack/gx:Track/gx:coord 
kml/Document/Placemark/gx:MultiTrack/gx:Track/when 
kml/Document/Placemark/gx:MultiTrack/gx:interpolate 
kml/Document/Placemark/name 
kml/Document/Placemark/styleUrl 
kml/Document/Schema 
kml/Document/Schema/gx:SimpleArrayField 
kml/Document/Schema/gx:SimpleArrayField/displayName 
kml/Document/Style 
kml/Document/Style/IconStyle 
kml/Document/Style/IconStyle/Icon 
kml/Document/Style/IconStyle/Icon/href 
kml/Document/Style/IconStyle/hotSpot 
kml/Document/Style/IconStyle/scale 
kml/Document/Style/LineStyle 
kml/Document/Style/LineStyle/color 
kml/Document/Style/LineStyle/width 
kml/Document/atom:author 
kml/Document/atom:author/atom:name 
kml/Document/name 
kml/Document/open 
kml/Document/visibility 

回答

0

這是默認名稱空間問題(請參閱5.1: Namespaces and default namspace)。

xmlstarlet ed -N k=http://www.opengis.net/kml/2.2 -d '/k:kml/k:Document/k:Placemark/gx:MultiTrack/gx:Track/k:when' text.kml 

在1.2.0之前的版本中,也需要-N gx=http://www.google.com/kml/ext/2.2

+0

謝謝,但我沒有運氣。沒有刪除任何記錄...我會嘗試上傳文件。 – user2389243