Atlaslog
Atlaslog / Cesium / Tutorial / 3D coordinates, height and local frames
Cesium · Tutorial

3D coordinates, height and local frames

Quick answer

This tutorial maps the three coordinate representations CesiumJS mixes: Cartographic in radians and metres, Cartesian3 in ECEF metres, and local east-north-up frames. It shows Cartographic.fromDegrees, Cartesian3.fromRadians, Cartesian3.fromDegreesArray and Transforms.eastNorthUpToFixedFrame with Matrix4 multiplication. It also explains heightReference values, globe.getHeight, pickEllipsoid versus pickPosition and cartesianToCanvasCoordinates. Readers can convert between all forms and place models or labels without drift.

Last verified 2026-11-03 · CesiumJS 1.121 · Cite this page
Key points
Example
var carto = Cesium.Cartographic.fromDegrees(116.391263, 39.907359, 50);
console.log(carto.longitude);   // 2.0313...
console.log(carto.latitude);    // 0.6965...
console.log(carto.height);      // 50
var cartesian = Cesium.Cartesian3.fromRadians(
  carto.longitude, carto.latitude, carto.height
);
var back = Cesium.Cartographic.fromCartesian(cartesian, Cesium.Ellipsoid.WGS84);
var positions = Cesium.Cartesian3.fromDegreesArray([
  116.391, 39.907,
  116.404, 39.915,
  116.418, 39.921
]);
viewer.entities.add({
  position: Cesium.Cartesian3.fromDegrees(116.391263, 39.907359),
  point: {
    pixelSize: 10,
    color: Cesium.Color.fromCssColorString('#4d9bff'),
    heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  },
  label: {
    text: '地面点',
    heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
    disableDepthTestDistance: Number.POSITIVE_INFINITY
  }
});
var carto = Cesium.Cartographic.fromDegrees(116.391263, 39.907359);
var ground = viewer.scene.globe.getHeight(carto);   // 地形未加载完时返回 undefined
Notes
Runnable examplesChinese originalAll Tutorials
English edition written for Atlaslog. Code is taken from the original Chinese page and runs unchanged.
Cite this page

Atlaslog (2026). 3D coordinates, height and local frames. https://www.jingweizhi.com/en/cesium/tutorials/coordinates.html (accessed 2026-11-03).