<!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_test</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', requestRenderMode:false, }); viewer.scene.globe.depthTestAgainstTerrain=false; bmgl.Resource.fetchJson({ url:'/bmgl/data/data/population909500.json' }).then(function (data) { var all=[]; for(let i=0;i<data[0][1].length;i+=3){ if (!data[0][1][i+2]) continue; all.push(new bmgl.GeometryInstance({ geometry:new bmgl.PolylineGeometry({ width:3, colors: [bmgl.Color.fromHsl(0.6 - data[0][1][i+2]* 0.5, 1.0, 0.5)], positions:[ bmgl.Cartesian3.fromDegrees(data[0][1][i+1],data[0][1][i],0), bmgl.Cartesian3.fromDegrees(data[0][1][i+1],data[0][1][i],data[0][1][i+2]*10000000), ], }) })); } var p=new bmgl.Primitive({ geometryInstances:all, appearance : new bmgl.PolylineColorAppearance({ translucent : false }) }); viewer.scene.primitives.add(p); }) </script> </body> </html>
源码