cesium 根据经纬度高度进行额度补偿
2026/6/5 2:20:44 网站建设 项目流程
const offsetvalue = 90; /** *度数补偿值 */ const setCameraPosition = async (lat: number, lon: number, du: number) => { var point = turf.point([lat, lon]); var distance = 600 * 1.732; var bearing = du - 180 + offsetvalue; var options: any = { units: "kilometers" }; var destination = turf.destination(point, distance / 1000, bearing, options); console.log("destination:", destination.geometry.coordinates); let latnew = 0; let lonnew = 0; var fsd = 105; var shiyejili = 250; let duoffsetvalue = du + offsetvalue; latnew = destination.geometry.coordinates[0]; lonnew = destination.geometry.coordinates[1]; console.log("duoffsetvalue:",duoffsetvalue,"latnew, lonnew:",latnew, lonnew) viewer.scene.camera.setView({ destination: Cesium.Cartesian3.fromDegrees(latnew, lonnew, 1000), // 经度,纬度,高度 orientation: { heading: Cesium.Math.toRadians(duoffsetvalue), // 方向 pitch: Cesium.Math.toRadians(-45), // 俯仰角 roll: 0.0, // 翻滚角 }, }); console.log("视角:", lat); };

offsetvalue、distance

var destination = turf.destination(point, distance / 1000, bearing, options);内的数据根据实际需求进行更改

const offsetvalue = 90;
/**
*度数补偿值
*/
const setCameraPosition = async (lat: number, lon: number, du: number) => {
var point = turf.point([lat, lon]);
var distance = 600 * 1.732;
var bearing = du - 180 + offsetvalue;
var options: any = { units: "kilometers" };
var destination = turf.destination(point, distance / 1000, bearing, options);
console.log("destination:", destination.geometry.coordinates);

let latnew = 0;
let lonnew = 0;
var fsd = 105;
var shiyejili = 250;
let duoffsetvalue = du + offsetvalue;
latnew = destination.geometry.coordinates[0];
lonnew = destination.geometry.coordinates[1];

console.log("duoffsetvalue:",duoffsetvalue,"latnew, lonnew:",latnew, lonnew)
viewer.scene.camera.setView({
destination: Cesium.Cartesian3.fromDegrees(latnew, lonnew, 1000), // 经度,纬度,高度
orientation: {
heading: Cesium.Math.toRadians(duoffsetvalue), // 方向
pitch: Cesium.Math.toRadians(-45), // 俯仰角
roll: 0.0, // 翻滚角
},
});
console.log("视角:", lat);
};

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询