(1)主要过程:结合Kriging.js 实现 Mapboxgl 上的插值图
(2)效果:

(3)代码
HTML 、CSS:
<head>
<meta charset="UTF-8" />
<title>Mapboxgl(canvas) + kriging.js</title>
<style>
html,
body,
#map {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
</style>
<link rel="stylesheet" href="../lib/js/geoglobe/mapbox-gl.css" type="text/css" />
<script type="text/javascript" src="../lib/js/geoglobe/mapbox-gl.js"></script>
<script type="text/javascript" src="../lib/js/turf/turf_new.min.js"></script>
<script type="text/javascript" src="../lib/js/interpolation/kriging_noModule.js"></script>
<!-- 行政区划数据 (为了偷懒使用了js的形式) -->
<script src="./data/wuhanShi.js"></script>
<body>
<!-- 用于绘制插值图的canvas -->
<canvas id="canvasMap" style="display: none; opacity: 0.2"></canvas>
<div id="map"></div>
<script src="./js/mapboxKriging.js"></script>
</body>
</head>
完整 JS:
// 颜色范围 (自定义)
const

最低0.47元/天 解锁文章
192

被折叠的 条评论
为什么被折叠?



