I'm working on a project that plots a track from GPX file onto google maps, and color-code it with an attribute (let's call it Score
). I've done some editing that now there is an additional tag Score
for each coordinate in this GPX file. Here is a snippet of my modified GPX file.
<trkpt lat="50.834048" lon="-0.127354"> <ele>31.0</ele>
<Score>-0.64730385</Score>
<time>2016-07-07T14:31:51Z</time>
</trkpt>
<trkpt lat="50.833833" lon="-0.127600"> <ele>31.0</ele>
<Score>-0.647203</Score>
<time>2016-07-07T14:32:09Z</time>
</trkpt>
I'm learning Google maps' javascript API to do the plotting part. My question is, how to create a ployline that changes color based on Score
? I understand that I can draw thousands of mini polylines with just two points, and set a color for each of them. But it feels very primitive. Are there better ways of doing it? Also, I could write my own function to parse this GPX file, but why doesn't google maps support GPX?
If it helps to illustrate my purpose, this is what I try to achieve:
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…