<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <script src="http://bigemap.com/offline_data/newjunbiao/vue.js"></script> <link href="http://ua.bigemap.com:30081/bmsdk/bigemap-gl.js/v1.1.0/Widgets/widgets.css" rel="stylesheet" /> <script src="http://ua.bigemap.com:30081/bmsdk/bigemap-gl.js/v1.1.0/bigemap-gl.js"></script> <!-- elementui --> <script src="http://bigemap.com/offline_data/newjunbiao/elementui.js"></script> <link rel="stylesheet" href="http://bigemap.com/offline_data/newjunbiao/elementui.css" /> <title>加载billboard</title> <style> * { margin: 0; padding: 0; } html, body { width: 100%; height: 100%; } #app { width: 100%; height: 100%; } #baseMap { width: 100%; height: 100%; } .tools { position: absolute; z-index: 9; top: 40px; right: 60px; width: 200px; height: 40px; display: flex; align-items: center; } </style> </head> <body> <div id="app"> <div id="baseMap"></div> </div> <script> let viewer = null; window.onload = () => { new Vue({ el: "#app", data() { return {}; }, mounted() { this.initMap(); }, methods: { //初始化地图 initMap() { bmgl.Config.HTTP_URL = "http://ua.bigemap.com:30081/bmsdk/"; viewer = new bmgl.Viewer("baseMap", { mapId: "bigemap.dc-satellite", infoBox: false, selectionIndicator: false, requestRenderMode: false, // terrainId指定离线服务器上发布的高程服务的id terrainId: "bigemap.dc-terrain", }); this.loadBillboard(); }, // 添加广告牌billboard loadBillboard() { viewer.entities.add({ //设置billboard的位置 position: bmgl.Cartesian3.fromDegrees( 102.95768738, 31.16639713, 6000 ), billboard: { image: "/offline_data/food.png", //设置固定宽高大小 width: 32, height: 32, // 设置图标贴地 heightReference: bmgl.HeightReference.CLAMP_TO_GROUND, }, }); viewer.entities.add({ position: bmgl.Cartesian3.fromDegrees( 103.04489136, 31.16052154, 6000 ), billboard: { image: "/offline_data/point.png", //设置广告牌安装图片比例缩放大小 scale: 2, }, }); viewer.flyTo(viewer.entities); }, }, beforeDestroy() { viewer.destroy(); viewer = null; }, }); }; </script> </body> </html>