3DGS模型三维量测
三维量测插件支持3DGS数据距离和面积量测功能。


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>3DGS模型三维量测</title>
<style>
body {
margin: 0;
padding: 0;
}
#map {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
}
.btn-group {
position: absolute;
top: 20px;
left: 20px;
}
</style>
<script src="https://delivery.mapmost.com/cdn/sdk/webgl/v9.6.0/mapmost-webgl-min.js"></script>
<script src="https://delivery.mapmost.com/cdn/sdk/plugins/mapmost-webgl-measure3D/v1.2.0/mapmost-webgl-measure3D.js"></script>
</head>
<body>
<div id="map"></div>
<div class="btn-group">
<button onclick="distance()">距离测量</button>
<button onclick="area()">面积测量</button>
<button onclick="clearMeas()">清除测量</button>
</div>
<script>
var map = new mapmost.Map({
style: '<your style url>',
container: 'map',
center: [120.78575270115562, 31.41174980621166],
zoom: 16.9,
bearing: -9.598,
pitch: 52.989,
sky: 'light',
userId:'***', // 授权码
});
let meas;
map.on('load', function () {
// 添加3DGS数据
map.addLayer({
id: 'gs-3d-layer',
type: '3DGS',
url: './building.splat',
coord: [121.6857884, 30.6702618, -30]
});
meas = new Measure3D(map);
});
function distance() {
// 距离测量
meas.setType("distance");
}
function area() {
// 面积测量
meas.setType("area");
}
function clearMeas() {
// 清除绘制
meas.clear();
}
</script>
</body>
</html>