<!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} #position{ background-color: #f1f1f1; padding: 10px; position: absolute; left: 0; top:10px; z-index: 9; } </style> <title>part_test</title> </head> <body> <div id='container'></div> <div id="position"> </div> <script> bmgl.Config.HTTP_URL = 'http://bigemap.com:9000'; var viewer = new bmgl.Viewer('container', { terrainId: 'bigemap.9af15d8e',mapId: 'bigemap.zhongkexingtu' }); viewer.camera.setView({ destination:new bmgl.Cartesian3(-1233524.2528105492,5342784.449529671,3266300.735257586), orientation:{ heading:5.737109377827798, roll:6.281571490802099, pitch:-0.3089655832119651, } }) viewer.screenSpaceEventHandler.setInputAction(function (e) { var cartesian3=viewer.scene.globe.pick(viewer.camera.getPickRay(e.endPosition),viewer.scene); if (!bmgl.defined(cartesian3)){ document.getElementById('position').innerHTML=''; return; } var cartographic=bmgl.Cartographic.fromCartesian(cartesian3); document.getElementById('position').innerHTML='高程值:'+cartographic.height.toFixed(0); },bmgl.ScreenSpaceEventType.MOUSE_MOVE); </script> </body> </html>
源码