Visualizing ECI orbits in cesium

Hi all,
currently working a project where I would like to visualize the orbit of a satellite using the ECI frame. I’ve tried doing some research online saying I need to use CZML in order to this and make sure I set the reference frame to “INERTIAL” which I’ve done, but the resulting orbit is in the wrong place or shifted and I don’t understand what I’m missing. I’m also not super knowledgeable about how orbit in general and knowledge really only spans as far as there are several reference frames which satellites can be plotted on so forgive me if there is something missing that should be obvious to those who know a lot more about this. I’ve been using the satellite.js library to calculate the ECI positions, which has been pretty accurate for ECEF coordinates and can only assume that is the case for ECI. Is there something wrong with how I’m setting up my CZML file that would cause the polyline I’m rendering to not be accurate? Here is the code that I’ve been using to generate ECI coordinates and produce a czml file that should be rendered:


export function getPositionsECI(tleline1: string, tleline2: string) {
	const NUM_OF_POINTS = 180;
	const satrec = twoline2satrec(tleline1, tleline2);
	const period = 1 / (satrec.no / (2 * Math.PI));
	const intervalMinutes = period / NUM_OF_POINTS; // Get evenly distrbuted minutes for points
	const curr = new Date();
	const positions = [];

	for (let i = 0; i < NUM_OF_POINTS; i++) {
		// Increment date by intervalMinutes
		// * 60 * 1000 is to convert from minutes to milliseconds cause thats what constructor expects
		const date = new Date(curr.getTime() + i * intervalMinutes * 60 * 1000);
		const positionAndVelocity = propagate(satrec, date);

		if (positionAndVelocity?.position) {
			// positions are in kilometers and need to be converted to meters
			positions.push(positionAndVelocity.position.x * 1000);
			positions.push(positionAndVelocity.position.y * 1000);
			positions.push(positionAndVelocity.position.z * 1000);
		}
	}

	const dataHeader = {
		id: "document",
		version: "1.0",
	};

	const dataBody = {
		id: "satellite orbit",
		polyline: {
			positions: {
				referenceFrame: "INERTIAL",
				cartesian: positions,
			},
			material: {
				solidColor: {
					color: {
						rgba: [0, 255, 255, 255],
					},
				},
			},
			width: 2,
		},
	};

	const czmlECIOrbit = [dataHeader, dataBody];

	return czmlECIOrbit;
}