一、wmts切片渲染样例
const map = new HGZH3D.Map('map')
// 可加载ArcGIS MapServer服务的网址,如下为部分服务路径:
// 影像图层-https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer
// 物理地图-https://services.arcgisonline.com/arcgis/rest/services/World_Physical_Map/MapServer
// 蓝底地图-http://map.geoq.cn/arcgis/rest/services/ChinaOnlineStreetPurplishBlue/MapServer
const layer = map.imageryLayers.addImageryProvider(
new HGZH3D.UrlTemplateImageryProvider({
url: 'http://127.0.0.1:18200/server/wmts?request=getTile&layerName=image4326&z={z}&x={x}&y={y}',
tilingScheme:
new HGZH3D.GeographicTilingScheme()
})
)
map.camera.setView({
destination: new HGZH3D.Cartesian3(-2334150.260768999, 5060557.222830746, 3237209.9791928013),
});
二、地形
const map = new HGZH3D.Map('map', {
terrainProvider: new HGZH3D.CesiumTerrainProvider({
url: 'http://127.0.0.1:18200/server/wtrs/getTile/china_dem'
})
})
const layer = map.imageryLayers.addImageryProvider(
new HGZH3D.WebMapTileServiceImageryProvider({
url: `http://{s}.tianditu.com/img_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=img&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk=bd12bbd5d1e8ce0b764788c6bc45cb24`,
layer: 'tdtBasicLayer',
style: 'default',
format: 'image/jpeg',
tileMatrixSetID: 'GoogleMapsCompatible',
subdomains: ['t0', 't1', 't2', 't3', 't4', 't5', 't6', 't7'],
maximumLevel: 18
})
)
map.camera.setView({
destination: new HGZH3D.Cartesian3(
-1166717.9465769199,
5527827.361295284,
2956039.227931624
),
orientation: {
heading: 5.770413650578632,
pitch: -0.2653003184863123,
roll: 0.000006656683100736416
}
})
三、倾斜摄影
const map = new HGZH3D.Map('map')
map.imageryLayers.addImageryProvider(
new HGZH3D.WebMapTileServiceImageryProvider({
url: `http://{s}.tianditu.com/img_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=img&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk=bd12bbd5d1e8ce0b764788c6bc45cb24`,
layer: 'tdtBasicLayer',
style: 'default',
format: 'image/jpeg',
tileMatrixSetID: 'GoogleMapsCompatible',
subdomains: ['t0', 't1', 't2', 't3', 't4', 't5', 't6', 't7'],
maximumLevel: 18
})
)
const tileset = new HGZH3D.Cesium3DTileset({
url: 'http://127.0.0.1:18200/server/wtls/getTile/build/tileset.json'
})
tileset.readyPromise.then(function (tileset) {
map.scene.primitives.add(tileset)
map.camera.flyToBoundingSphere(tileset.boundingSphere, { duration: 0 })
})