如果我們要在web端加載我們自身的數(shù)據(jù),超圖和cesium都有方法,cesium方法比較簡(jiǎn)單,可以用到cesiumlab這個(gè)比較方便的工具。其中有傾斜數(shù)據(jù)(osgb)處理方法。其中只要數(shù)據(jù)正確,他會(huì)自動(dòng)讀取傾斜攝影中的坐標(biāo)。切出來(lái)的數(shù)據(jù)通過(guò)添加3dtiles的方法就能夠正確的添加到web端的網(wǎng)頁(yè)中。(新版本的cesium好像要添加token才能夠添加底圖,可以去申請(qǐng)ion。清楚原因的小伙伴可以科普一下為啥)
var viewer = new Cesium.Viewer('cesiumContainer', {
selectionIndicator : false,animation : false,//是否創(chuàng)建動(dòng)畫(huà)小器件,左下角儀表
baseLayerPicker : false,//是否顯示圖層選擇器
fullscreenButton : false,//是否顯示全屏按鈕
geocoder : false,//是否顯示geocoder小器件,右上角查詢按鈕
homeButton : false,//是否顯示Home按鈕
infoBox : false,//是否顯示信息框
sceneModePicker : false,//是否顯示3D/2D選擇器
selectionIndicator : false,//是否顯示選取指示器組件
timeline : false,//是否顯示時(shí)間軸
navigationHelpButton : false,//是否顯示右上角的幫助按鈕
scene3DOnly : true,
automaticallyTrackDataSourceClocks : false,//自動(dòng)追蹤最近添加的數(shù)據(jù)源的時(shí)鐘設(shè)置
sceneMode : Cesium.SceneMode.SCENE3D,//初始場(chǎng)景模式
});
var tilesetbuilding = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
url: , //自己切片的地址,應(yīng)用到切片的tileset.json
}));
tilesetbuilding.readyPromise.then(function () {
var boundingSphere = tilesetbuilding.boundingSphere;
viewer.camera.viewBoundingSphere(boundingSphere, new Cesium.HeadingPitchRange(0.0, -0.5, boundingSphere.radius));
viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
}).otherwise(function (error) {
throw (error);
});
//設(shè)置操作習(xí)慣,更換中鍵和右鍵
viewer.scene.screenSpaceCameraController.tiltEventTypes = [
Cesium.CameraEventType.RIGHT_DRAG, Cesium.CameraEventType.PINCH,
{ eventType: Cesium.CameraEventType.LEFT_DRAG, modifier: Cesium.KeyboardEventModifier.CTRL },
{ eventType: Cesium.CameraEventType.RIGHT_DRAG, modifier: Cesium.KeyboardEventModifier.CTRL }
];
viewer.scene.screenSpaceCameraController.zoomEventTypes = [Cesium.CameraEventType.MIDDLE_DRAG, Cesium.CameraEventType.WHEEL, Cesium.CameraEventType.PINCH];
這樣就能夠展示我們的傾斜攝影了下面說(shuō)下supermap方法。首先要生成supermap讀的懂得傾斜攝影緩存。打開(kāi)supermap,在菜單欄選項(xiàng)卡中選擇若果不設(shè)置中心點(diǎn)坐標(biāo)的,生成的數(shù)據(jù)可能會(huì)生成達(dá)到大西洋上(0,0),所以我們要獲取傾斜攝影的中心點(diǎn)坐標(biāo)。smart 3d導(dǎo)出的傾斜攝影會(huì)有這個(gè)文件metadata.xml.打開(kāi)該文件
<?xml version="1.0" encoding="utf-8"?>
<ModelMetadata version="1">
<!--Spatial Reference System-->
<SRS>EPSG:4549</SRS>
<!--Origin in Spatial Reference System-->
<SRSOrigin>525138.5,3502954,0</SRSOrigin>
<Texture>
<ColorSource>Visible</ColorSource>
</Texture>
</ModelMetadata>
其中包含了它的投影以及中心點(diǎn)坐標(biāo)。可以通過(guò)在線網(wǎng)址:http://epsg.io/去轉(zhuǎn)換投影點(diǎn)擊Transform coordinates按鈕進(jìn)入坐標(biāo)轉(zhuǎn)換界面。在輸入經(jīng)緯度轉(zhuǎn)成上述文件的坐標(biāo)系,然后輸入中心點(diǎn)坐標(biāo)。輸出欄選擇我們需要的經(jīng)緯度坐標(biāo)系。點(diǎn)擊轉(zhuǎn)換救獲得了我們需要的坐標(biāo)系。然后生成scp文件。注意雖然新版本的超圖iserver已經(jīng)支持osgb格式的三維文件,但是為了穩(wěn)定性以及效率。需要將其轉(zhuǎn)換成s3m的文件,