2013-05-16 33 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