admin管理员组

文章数量:1336563

Is there any way to display gradient polyline in cesium.js? Color will matter from speed like on garmin or strava. First get the color for first point, count percents of speed beetwen min speed and max speed and set for the start color then set the right color between blue and red with yellow on the middle, then for the second point set as end color and then display gradient for that petacular segment interpolated from start and end color. Also with 3d tileset please:) .

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <script src=".122/Build/Cesium/Cesium.js"></script>
  <link href=".122/Build/Cesium/Widgets/widgets.css" rel="stylesheet">
  <style>
    html, body, #cesiumContainer {
      width: 100%;
      height: 100%;
      margin: 0;
      padding: 0;
      overflow: hidden;
    }
  </style>
</head>
<body>
  <div id="cesiumContainer"></div>
  <script>
    Cesium.Ion.defaultAccessToken = 'MY_CESIUM.ION_ACCESS_TOKEN';
    const viewer = new Cesium.Viewer("cesiumContainer", {
        requestRenderMode: true,
        maximumRenderTimeChange: Infinity
    });
    positions = {
    // lat, lon, speed(m/s)
        -75, 35,30
        -100,35,56
        -125, 35,76
        -150,35,75
    }
    viewer.entities.add{
        //The magic here
    }
  </script>
</body>
</html>

effect should look like this image from garmin

Thank you very much in advance!

本文标签: javascriptGradient polyline in cesium jsStack Overflow