<!DOCTYPE html> <html> <head> <meta charset='UTF-8' /> <meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' /> <link href='http://bigemap.com:9000/bigemap-gl.js/v1.1.0/Widgets/widgets.css' rel='stylesheet' /> <script src='http://bigemap.com:9000/bigemap-gl.js/v1.1.0/bigemap-gl.js'></script> <style> body { margin: 0; padding: 0; } #container { position: absolute; top: 0; bottom: 0; width: 100%; } .bmgl-widget-credits { display: none } </style> <title>part_cd</title> </head> <body> <div id='container'></div> <script> bmgl.Config.HTTP_URL = 'http://bigemap.com:9000'; var viewer = new bmgl.Viewer('container', {mapId: 'bigemap.zhongkexingtu',}); //不启用地形遮挡 viewer.scene.globe.depthTestAgainstTerrain = false; var tj; var tilesets = new bmgl.BM3DTileset({ url: '/bmgl/data/zhcdjz2/tileset.json' }); tilesets.readyPromise.then(function (tileset) { tj = viewer.scene.primitives.add(tileset); default_HeadingPitchRange = new bmgl.HeadingPitchRange(0.0, -0.5, tileset.boundingSphere.radius * 2.0); viewer.zoomTo(tileset, default_HeadingPitchRange); var cartographic = bmgl.Cartographic.fromCartesian(tileset.boundingSphere.center); var delta_lng = 0, delta_lat = 0; var surface = bmgl.Cartesian3.fromRadians(cartographic.longitude + delta_lng, cartographic.latitude + delta_lat, 0.0); var offset = bmgl.Cartesian3.fromRadians(cartographic.longitude + delta_lng, cartographic.latitude + delta_lat, 0); var translation = bmgl.Cartesian3.subtract(offset, surface, new bmgl.Cartesian3()); tileset.modelMatrix = bmgl.Matrix4.fromTranslation(translation); tj.style = new bmgl.BM3DTileStyle({ color: { conditions: [ ['${height} >= 300', 'rgba(45, 0, 75, 0.5)'], ['${height} >= 200', 'rgb(102, 71, 151)'], ['${height} >= 100', 'rgb(170, 162, 204)'], ['${height} >= 50', 'rgb(224, 226, 238)'], ['${height} >= 25', 'rgb(252, 230, 200)'], ['${height} >= 10', 'rgb(248, 176, 87)'], ['${height} >= 5', 'rgb(198, 106, 11)'], ['true', 'rgb(127, 59, 8)'] ] } }); }).otherwise(function (error) { console.log(error); }); </script> </body> </html>
源码