colorise single track in kml file

倖福魔咒の 提交于 2019-11-30 14:24:31

As previous answer says, you have to split track into segments and color each segment individually. There is no other way to do this using KML. But remember that this can create very large KML files for long tracks! So try to save some space by using shared styles.

I would recommend creating one "gx:track" with low "draworder" for whole track and collection of placemarks with different colors and high "draworder" for every small segment of track.

You can examine results of this approach here: http://www.zonefivesoftware.com/sporttracks/plugins/?p=dobrou-extensions (it is a plugin for application SportTracks).

It's my tool for visualization of GPS tracks. It does track coloring by creating placemark, with own color style, for every track segment.

Here you can see examples tracks colored in KML:

Track colored by speed #1 KMZ

Track colored by speed #2 KMZ

Track colored by elevation KMZ

As you discovered, you can only style complete tracks. If you want different segments to have different colors, you need to break the track up, then style each segment.

I used simplekml which uses Python to generate KML code. As the other answers point out you have to split the line into multiple linestrings each of which has a different style. You can use a common set of styles for making the size of kml smaller though.

the end coordinates of one line is the start coordinates of the next line.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!