坐标系系统

引擎采用双坐标系架构,实现建筑信息模型与地理信息系统的无缝集成。

场景坐标系类型

BIM场景 - 本地坐标系(EPSG:3857)

BIM场景使用Web墨卡托投影坐标系作为本地参考框架,适用于建筑模型的精确建模和渲染:

// BIM本地坐标(EPSG:3857)
const bimPosition = {
  x: 12958175.0,  // 东向坐标(米)
  y: 4825943.0,   // 北向坐标(米)
  z: 50.0         // 高程(米)
};

GIS场景 - 全球坐标系(EPSG:4326)

GIS场景使用WGS84地理坐标系,支持全球范围的地理定位和空间分析:

// GIS全球坐标(EPSG:4326)
const gisPosition = {
  longitude: 116.3974,  // 经度(度)
  latitude: 39.9093,   // 纬度(度)
  altitude: 50.0        // 海拔高度(米)
};

坐标系转换

地理坐标转投影坐标

将WGS84地理坐标转换为Web墨卡托投影坐标(EPSG:4326 转 EPSG:3857)

function geographicToWebMercator(longitude, latitude) {
  // 将角度转换为弧度
  const lonRad = longitude * Math.PI / 180;
  const latRad = latitude * Math.PI / 180;
  // Web墨卡托投影公式
  const x = longitude * 20037508.34 / 180;
  const y = Math.log(Math.tan((90 + latitude) * Math.PI / 360)) / (Math.PI / 180) * 20037508.34 / 180;
  return { x, y };
}

投影坐标转地理坐标

将Web墨卡托投影坐标转换为WGS84地理坐标(EPSG:3857 转 EPSG:4326)

function webMercatorToGeographic(x, y) {
  // 逆Web墨卡托投影公式
  const longitude = (x / 20037508.34) * 180;
  let latitude = (y / 20037508.34) * 180;
  // 计算纬度(需要迭代求解)
  latitude = 180 / Math.PI * (2 * Math.atan(Math.exp(latitude * Math.PI / 180)) - Math.PI / 2);
  return { longitude, latitude };
}

高程系统

椭球高

椭球高(Ellipsoidal Height)是基于WGS84参考椭球体的高程系统,用于GPS测量和卫星定位:

// WGS84椭球高
const ellipsoidalHeight = {
  height: 50.0,         // 椭球高(米)
  reference: "WGS84"    // 参考椭球体
};

正高

正高(Orthometric Height)是基于大地水准面的高程系统,用于工程测量和实际应用:

// 正高(海拔高)
const orthometricHeight = {
  elevation: 45.2,      // 正高(米)
  reference: "EGM96"   // 大地水准面模型
};

坐标系配置

场景坐标系设置

// 创建地图时设置空间参考
const scene = new Scene({
  basemap: "satellite",
  ground: "world-elevation",
  spatialReference: {
    wkid: 3857 // Web墨卡托投影坐标系
  }
});

// 创建场景视图时设置相机位置和坐标系
const sceneView = new SceneView({
  container: "app",
  scene: scene,
  camera: {
    position: {
      x: 116.3974,  // 经度(度)
      y: 39.9093,   // 纬度(度)
      z: 500,       // 高度(米)
      spatialReference: {
        wkid: 4326  // WGS84地理坐标系
      }
    },
    heading: 0,
    tilt: 45
  }
});

// 设置场景的空间参考(用于BIM模型集成)
sceneView.spatialReference = {
  wkid: 3857  // Web墨卡托投影坐标系
};

// 设置视图中心点(模型原点)
// 使用经纬度数组设置中心点(EPSG:4326)
sceneView.center = [116.3974, 39.9093];  // [经度, 纬度]

// 或者使用Point对象(EPSG:4326)
sceneView.center = new Point({
  longitude: 116.3974,
  latitude: 39.9093,
  spatialReference: { wkid: 4326 }
});

// 设置BIM本地坐标系中心点(Web墨卡托投影坐标)
sceneView.center = new Point({
  x: 12958175.0,
  y: 4825943.0,
  spatialReference: { wkid: 3857 }
});

BIMFlux AI