// 计算位置
function calcPosition(lng, lat, alt) {
var phi = (90-lat)*(Math.PI/180),
theta = (lng+180)*(Math.PI/180),
radius = alt+200,
x = -(radius * Math.sin(phi) * Math.cos(theta)),
z = (radius * Math.sin(phi) * Math.sin(theta)),
y = (radius * Math.cos(phi));
return {x: x, y: y, z: z};
}
调用
calcPosition(114.662688, 30.791616, 3459); // {x: -1311.5833759459222, y: 1873.1049219485822, z: -2856.4852527738162}
网友评论