Error while creating a polyline in Cesium!

I am using the following code to create a polyline in my ReactJs app. I am getting “DeveloperError: Expected value to be greater than or equal to0.0125, the actual value was 0” error message. Can someone please explain to me why am I getting this error?

var viewer = new Cesium.Viewer("cesiumContainer");

var redLine = viewer.entities.add({
name: "Red line on terrain",
polyline: {
positions: Cesium.Cartesian3.fromDegreesArray([180,90, 180, -90]),
width: 5,
material: Cesium.Color.RED,
clampToGround: true,

Maybe try a more realistic line:


Yes, I have already tried it in Cesium Sandcastle. But my question is why error is being thrown. What is the reason behind it?

Drawing a polyline that conforms to the shape of an ellipsoid necessitates the creation of intermediate points between the specified points. Computing the number of points is dependent on the length and the desired smoothness (granularity property of PolylineGraphics) of the resulting line.

The length of the line (a geodesic) is computed using Vincenty’s inverse formula which can fail when the end points are nearly antipodal (separated by 180 degrees). This error is telling you that the points you provided are nearly antipodal. The value of 0.0125 radians is about 0.7162 degrees.

Hope that helps.

1 Like

It says the expected value has to be greater than or equal to 0.0125. About which/whose value is it referring to?

Also, the formula doesn’t seem to produce any error for other antipodals like (90,0) and (-90,0). :confused:

The angle between the two vectors defined by the points and the center of the earth.

I am getting the error when using (0, 90) and (0, -90).

Are these two vectors that you have mentioned in this comment are of the intermediate points(used for drawing line between 2 points) that you have mentioned in your first comment?

Also sorry, I meant points (90,0) and (-90,0), which are antipodal as well.

The two vectors are of the user-supplied points.

I’ve dug further in the code and found that lines are being split at the prime- and anti-meridians when such crossings are detected which explains why some combinations work.

Did somebody found a way to determine if the primitive can be handled by Cesium?
I have some weird geometry that crash Cesium but I need to filters them to keep the application alive.