Skip to main content

Load with geometry compression3DTiles

Loading tilt data containing geometric compression models requires settingsloadOptionsparameter.

show
   <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Load with geometry compression3DTilesModel</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no"/>
<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/lite/v9.1.0/mapmost-lite-min.js"></script>
</head>
<body>
<div id="map"></div>
<script>
var map = new mapmost.Map({
container: 'map',
style: "<your style url>",
center: [120.74449559193792, 31.30775326748954],
zoom: 16,
pitch: 60,
userId: '***', // Authorization code,This parameter must be added
});

map.on('load', function () {
const TILESET_URL = "<your 3dtiles url>";
map.add3dTilesLayer(
{
id: 'tile-3d-layer',
data: TILESET_URL,
loadOptions:{
draco:{//Load tilt data containing geometrically compressed models
libsUrl:"http://******/draco",//The resource has been uploaded and can be used on demand. You need to pass in the absolute path when using it.
}
}
}
)
})

function removeLayer() {
map.removeLayer('tile-3d-layer')
}
</script>
</body>
</html>