
该接口用于获取指定区域、版本和细节层级的3D Tiles数据,返回JSON格式的瓦片集描述文件。
| 参数名 | 类型 | 规则说明 | 是否必填 | 缺省值 |
| areaCode | string | 行政区划编码 | 必填 | 无 |
| version | string | 当前版本,默认需要给用户最新版本,最新版本为:3,也就是V3 | 必填 | 无 |
请求示例
https://api.open.geovisearth.com/pj/getfile/46/brainsim-3dtiles/999999/V1/lod/b/tileset.json?token=您的token返回示例
{
"asset": {
"version": "1.1"
},
"geometricError": 9783.93962050256,
"root": {
"boundingVolume": {
"box": [
-2444992.8542830693,
5041316.507033031,
3042466.3999288958,
4876.027740524706,
2367.758595341314,
-4.827818115241331,
-937.035772509987,
1932.0714142279096,
1173.6724734510192,
1138.1998084553616,
-2334.2562803517712,
4751.31171232077
]
},
"refine": "ADD",
"geometricError": 9783.93962050256,
"children": [
{
"boundingVolume": {
"box": [
-2444672.936836584,
5041198.326695656,
3042916.440464243,
4401.707282356552,
2134.558882968385,
0,
-1024.0452840707624,
2111.6998084816573,
-4292.251600202498,
-936.4391172190095,
1931.0457606184036,
1173.450555516618
]
},
"geometricError": 9783.93962050256,
"content": {
"uri": "14-26930-5582/tileset.json"
}
},
{
"boundingVolume": {
"box": [
-2445570.5968665993,
5041306.696053781,
3042021.4790941128,
4401.417558709459,
2135.156223393037,
0,
-1024.0310507492538,
2110.940734944894,
-4292.628360930124,
-936.7833935061241,
1931.088147888791,
1173.105960617828
]
},
"geometricError": 9783.93962050256,
"content": {
"uri": "14-26931-5583/tileset.json"
}
},
{
"boundingVolume": {
"box": [
-2444631.0680665206,
5041768.216877983,
3042011.839610947,
4401.816358542471,
2134.3339406189107,
0,
-1023.633441076594,
2111.1253212678953,
-4292.63241853075,
-936.4235084067918,
1931.2649437760747,
1173.1022487179862
]
},
"geometricError": 9783.93962050256,
"content": {
"uri": "14-26930-5583/tileset.json"
}
},
{
"boundingVolume": {
"box": [
-2445345.391562242,
5040869.333843731,
3042921.067261066,
4401.422029190188,
2135.147007905842,
0,
-1024.3289928653717,
2111.5661720912603,
-4292.249647872922,
-936.6967038140846,
1930.9197406883939,
1173.4523408243647
]
},
"geometricError": 9783.93962050256,
"content": {
"uri": "14-26931-5582/tileset.json"
}
}
]
}
}<!DOCTYPE html>
<html>
<head>
<title>孪生模型展示Demo</title>
<meta charset="utf-8">
<script src="https://cesium.com/downloads/cesiumjs/releases/1.129/Build/Cesium/Cesium.js"></script>
<link href="https://cesium.com/downloads/cesiumjs/releases/1.129/Build/Cesium/Widgets/widgets.css" rel="stylesheet">
<link rel="icon" href="https://geovisearth.com/logo.png" type="image/x-icon">
<style>
/* 暗黑模式全局设置 */
:root {
--dark-bg: #1a1a1a;
--dark-panel: #252525;
--dark-text: #e0e0e0;
--dark-hover: #333333;
--dark-active: #3d3d3d;
--dark-border: #3a3a3a;
--primary-color: #4a8cff;
--primary-hover: #5d9bff;
--tag-bg: #b8eee7;
--disabled-bg: #3a3a3a;
--disabled-text: #777777;
}
body {
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
height: 100vh;
font-family: 'Segoe UI', 'PingFang SC', sans-serif;
}
.content-container {
display: flex;
flex: 1;
overflow: hidden;
}
/* 去除Cesium logo */
.cesium-widget-credits {
display: none !important;
}
/* 3D视图容器 */
#cesium-container {
flex: 1;
position: relative;
}
</style>
</head>
<body>
<!-- 内容容器 -->
<div class="content-container">
<div id="cesium-container"></div>
</div>
<script>
//#region 1、初始化Cesium Viewer
const viewer = new Cesium.Viewer('cesium-container', {
geocoder: false, // 隐藏搜索
homeButton: false, // 隐藏主页
sceneModePicker: false, // 隐藏二三维转换
baseLayerPicker: false, // 隐藏图层选择控件
navigationHelpButton: false, // 隐藏帮助按钮
animation: false, // 隐藏时钟
timeline: false, // 隐藏时间轴
fullscreenButton: false, // 隐藏全屏
vrButton: false, // 隐藏双屏模式
infoBox: false, // 隐藏点击 entity 信息框
selectionIndicator: false, // 隐藏点击 entity 绿框
shouldAnimate: true,
});
if (!viewer.scene.context.webgl2) {
console.error("WebGL 2.0 not supported");
}
// 最远可视距离(单位:米)
viewer.scene.screenSpaceCameraController.maximumZoomDistance = 20000000;
viewer.scene.fxaa = true; //开启抗锯齿
viewer.extend(Cesium.viewerCesium3DTilesInspectorMixin);
viewer.imageryLayers.remove(viewer.imageryLayers.get(0));
//#endregion
//#region 2、加载星图地球影像和地形
// 注册开放平台账号获取的token:
// 参考地址:https://open.geovisearth.com
let token = '您的token';
// 星图影像
var geovisMap = new Cesium.UrlTemplateImageryProvider({
url: "https://api.open.geovisearth.com/pj/base/v1/img/{z}/{x}/{y}?format=webp&tmsIds=w&token=" + token,
maximumLevel: 18,
});
viewer.imageryLayers.addImageryProvider(geovisMap);
// 星图影像注记
var geovisCia = new Cesium.UrlTemplateImageryProvider({
url: "https://api.open.geovisearth.com/pj/base/v1/cia/{z}/{x}/{y}?format=webp&tmsIds=w&token=" + token,
maximumLevel: 18,
});
viewer.imageryLayers.addImageryProvider(geovisCia);
(async function () {
const terrainProvider = await Cesium.CesiumTerrainProvider.fromUrl(
"https://api.open.geovisearth.com/pj/base/v1/terrain?token=" + token,
{
requestWaterMask: true,
requestVertexNormals: true,
}
);
viewer.terrainProvider = terrainProvider;
})();
//#endregion
//#region 3、加载3D Tiles模型
let tileset;
// 加载3DTiles模型
loadCityModel();
// 加载城市模型函数
async function loadCityModel() {
try {
// 加载3DTiles模型
let tileset = await Cesium.Cesium3DTileset.fromUrl("https://api.open.geovisearth.com/pj/getfile/46/brainsim-3dtiles/999999/V3/lod/b/tileset.json?token=" + token);
tileset.maximumScreenSpaceError = 80;
viewer.scene.primitives.add(tileset);
// 定位到模型
await viewer.zoomTo(tileset);
} catch (error) {
console.error(`加载失败: ${error}`);
alert(`加载失败: ${error.message}`);
}
}
//#endregion
</script>
</body>
</html>
返回值为:tileset.json ,一个 JSON 格式的文件,通常用于定义三维瓦片集(Tileset)的结构和属性。
属性详情:
asset:规范版本和工具信息。
properties:瓦片集的全局属性(如坐标系、单位、扩展字段)
boundingVolume:瓦片的物理/地理范围,用于空间查询和裁剪。
geometricError:控制瓦片渲染细节的误差值(值越大,加载的瓦片越粗糙)。
refine:瓦片细化策略,参数:ADD:叠加子瓦片到父瓦片(渐进增强),REPLACE:用子瓦片替换父瓦片。
content.uri:指向瓦片数据文件(如 .b3dm(瓦片压缩模型)、.glb(瓦片压缩模型))。
children:子瓦片集合(递归结构)