# How to draw lines of constant latitude (e.g. Tropic of Cancer)?

I’m trying to draw the tropics of Cancer and Capricorn (lines of constant latitude at about 23.5 and -23.5 degrees) using Polyline Entities like this:

var TROPIC_OF_CANCER_LAT = 23.43717;

// Create a single line around the equator and show it.

name : ‘Tropic Of Cancer’,

show: true,

polyline: {

loop: true,

positions : Cesium.Cartesian3.fromDegreesArray([-180, TROPIC_OF_CANCER_LAT,

-90, TROPIC_OF_CANCER_LAT,

0, TROPIC_OF_CANCER_LAT,

90, TROPIC_OF_CANCER_LAT,

180, TROPIC_OF_CANCER_LAT]),

width : 3,

material : Cesium.Color.GREEN

}

});

``

… but because the line segments follow great circle arcs, they don’t show as proper lines of latitude, but “scalloped” lines going from each of the line points provided in the array.

So, what’s the preferred method to draw a single line at a constant latitude? (I realize there are “image” layers that draw the grids, but that’s not what I’m looking for here.)

Thanks!

• Dave

Hello,

Cesium currently only has support for great arcs. If you want to follow the latitude lines, you will need to compute your own line. You can do this by adding many points to your polyline, and setting followSurface: false.

Here is an example:

var viewer = new Cesium.Viewer(‘cesiumContainer’);

var lon = -180;
var lat = 23.43717;
var pos = ;
for (var i = 0; i < 360; i++) {
pos.push(Cesium.Cartesian3.fromDegrees(lon, lat));
lon++;
}

polyline: {
followSurface: false,
width: 3,
material: Cesium.Color.GREEN,
positions: pos
}
});

``

Best,

Hannah

Hmm. Ok. This seems terribly inefficient, and breaks down when the Camera gets close to the Earth.

I supposed this falls under “feature suggestion” at this point.

Thanks,

Dave

Hmm, what do you mean when you say it breaks down then the camera gets close to the earth? I didn’t see any problems on my machine. Do you have depthTestAgainstTerrain turned on?
It’s actually not that inefficient. This is similar to the kind of subdivision Cesium does behind the scenes when computing the great arc between two points.

Best,

Hannah

Hannah,

My mistake. Looks good.

Thanks!

• Dave