1. 程式人生 > 其它 >arcgis 與luma.gl 結合做視覺化

arcgis 與luma.gl 結合做視覺化

arcgis 在官網有個可以和webgl 結合的案例 https://developers.arcgis.com/javascript/latest/sample-code/custom-gl-visuals/ 具體做法使用webgl 製作一個自己的customLayer圖層。

最近deck.gl 比較火,本質deck.gl 是基於luma.gl 來構建的可是三維元件,那麼通過luma.gl 也可以做開發。今天來分享這個用luma.gl 來做。


```
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no"/>
<title>luma.gl 結合</title>

<script src="https://cdn.bootcdn.net/ajax/libs/gl-matrix/2.8.1/gl-matrix.js"></script>
<script src="https://unpkg.com/[email protected]/dist.min.js"></script>
<link rel="stylesheet" href="https://js.arcgis.com/4.19/esri/themes/light/main.css" />
<script src="https://js.arcgis.com/4.19/"></script>

<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>

<script>
require([
"esri/WebMap",
"esri/Map",
"esri/core/watchUtils",
"esri/core/promiseUtils",
"esri/geometry/support/webMercatorUtils",
"esri/layers/GraphicsLayer",
"esri/views/MapView",
"esri/views/2d/layers/BaseLayerViewGL2D"
], function(
WebMap,
Map,
watchUtils,
promiseUtils,
webMercatorUtils,
GraphicsLayer,
MapView,
BaseLayerViewGL2D
) {

let CustomLayerView2D = BaseLayerViewGL2D.createSubclass({
constructor: function() {

this.transform = mat3.create();


this.rotation = mat3.create();


this.display = mat3.create();


this.screenTranslation = vec2.create();


this.translationToCenter = vec2.create();


this.needsUpdate = false;

更多資訊參考小專欄https://xiaozhuanlan.com/topic/1726308549