Calculate km CZML path

Hi,

I was looking at this example https://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Callback%20Property.html&label=Beginner,

but this is for a polyline, how can I do it for CZML.

I want to show the km of the path in a label as in the following image.

Regards.

Hi there,

Once your CZML s loaded, you can use either EllipsoidGeodesic (https://cesiumjs.org/Cesium/Build/Documentation/EllipsoidGeodesic.html) or the distance function in Cartesian3 (https://cesiumjs.org/Cesium/Build/Documentation/Cartesian3.html) to measure length, depending if you want to measure distance along the ellipsoid surface or just point to point.

Cesium loads all data as Entities, so it’s just a matter of getting the point data (your CZML may just load a polyline!) and measuring using one of the above methods.

Hope that helps,

  • Rachel