最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Gradient polyline in cesium. js - Stack Overflow

programmeradmin1浏览0评论

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!

发布评论

评论列表(0)

  1. 暂无评论