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="https://cesium.com/downloads/cesiumjs/releases/1.122/Build/Cesium/Cesium.js"></script>
  <link href="https://cesium.com/downloads/cesiumjs/releases/1.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!

2
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. Commented Nov 19, 2024 at 22:30
  • I want to create gradient polyline which color depends on speed while mu activity because i want to display activity on the map. Color will start as from blue then for faster segments will be yellow then red but i can to that i just don’t know how to display gradient polyline in cesium to is my issue. Commented Nov 20, 2024 at 6:30

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.