GeographicProjection
是一个用于将经纬度(WGS84)坐标转换为笛卡尔坐标(x、y、z)的 CesiumJS 投影对象。
import { GeographicProjection } from "cesium";
或
<script src="https://cesium.com/downloads/cesiumjs/releases/1.83/Build/Cesium/Cesium.js"></script>
const geographicProjection = new GeographicProjection();
const longitude = -75.59777;
const latitude = 40.03883;
const height = 0;
const cartesian = geographicProjection.project(
Cesium.Cartesian3.fromDegrees(longitude, latitude, height)
); // Cartesian3(-839184.3726153563, -4849129.465448539, 4073676.981600704)
const cartesian = Cesium.Cartesian3.fromDegrees(longitude, latitude, height);
const cartographic = geographicProjection.unproject(cartesian); // Cartographic {longitude: -75.59777, latitude: 40.03883, height: 0}