<where> 从 kml 文件中删除时间戳元素 谷歌我的足迹



我一直在Android上玩谷歌"我的曲目",并将曲目导入谷歌地球。当我这样做时,我在顶部得到时间条,赛道将在你驾驶时播放,就像你的赛道的动画一样。我想去掉这条轨道的时间方面和你在这条轨道上所做的点的时间方面。

我进入KML文件,看到每个点都有一个时间戳。我一直在尝试删除负责实际轨道时间方面的元素,首先使用:
xmlstarlet ed -d "kml/Document/Placemark/gx:MultiTrack/gx:Track/when" text.kml

对于placemark,如果我能纠正语法,我认为这个过程将是类似的。任何帮助都将非常感激。

Kml结构如下,元素是我想要删除的,不确定谷歌地球是否会高兴没有元素或只是让它是空白的。

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

这是默认命名空间的问题(参见5.1:命名空间和默认命名空间)。

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也是必需的

最新更新