mirror of
https://github.com/jiawanlong/Cesium-Examples.git
synced 2025-07-04 15:17:36 +00:00
GIS客户端分析 泰森多边形
This commit is contained in:
parent
3325f5f6f1
commit
24b955db61
81
examples/cesiumEx/8.1.2、泰森多边形.html
Normal file
81
examples/cesiumEx/8.1.2、泰森多边形.html
Normal file
@ -0,0 +1,81 @@
|
||||
<!--********************************************************************
|
||||
* by jiawanlong
|
||||
*********************************************************************-->
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="stylesheet" href="./../../cesium/Cesium1.98/Widgets/widgets.css">
|
||||
<script type="text/javascript" src="./../../cesium/Cesium1.98/Cesium.js"></script>
|
||||
<script src="./turf.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body style="margin: 0; overflow: hidden; background: #fff; width: 100%; height: 100%; position: absolute; top: 0">
|
||||
<div id="map" style="margin: 0 auto; width: 100%; height: 100%"></div>
|
||||
<script type="text/javascript">
|
||||
|
||||
Cesium.Ion.defaultAccessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI3ZjQ5ZGUzNC1jNWYwLTQ1ZTMtYmNjYS05YTY4ZTVmN2I2MDkiLCJpZCI6MTE3MTM4LCJpYXQiOjE2NzY0NDUyODB9.ZaNSBIfc1sGLhQd_xqhiSsc0yr8oS0wt1hAo9gbke6M'
|
||||
const viewer = new Cesium.Viewer('map', {});
|
||||
var points = turf.randomPoint(50, { bbox: [100, 20, 101, 21] });
|
||||
|
||||
for (var i = 0; i < points.features.length; i++) {
|
||||
points.features[i].properties.z = ~~(Math.random() * 9);
|
||||
}
|
||||
points.features.push({
|
||||
type: 'Feature',
|
||||
geometry: {
|
||||
type: 'Point',
|
||||
coordinates: [100, 20]
|
||||
},
|
||||
properties: {
|
||||
z: 5
|
||||
}
|
||||
});
|
||||
points.features.push({
|
||||
type: 'Feature',
|
||||
geometry: {
|
||||
type: 'Point',
|
||||
coordinates: [101, 20]
|
||||
},
|
||||
properties: {
|
||||
z: 3
|
||||
}
|
||||
});
|
||||
points.features.push({
|
||||
type: 'Feature',
|
||||
geometry: {
|
||||
type: 'Point',
|
||||
coordinates: [101, 21]
|
||||
},
|
||||
properties: {
|
||||
z: 4
|
||||
}
|
||||
});
|
||||
points.features.push({
|
||||
type: 'Feature',
|
||||
geometry: {
|
||||
type: 'Point',
|
||||
coordinates: [100, 21]
|
||||
},
|
||||
properties: {
|
||||
z: 2
|
||||
}
|
||||
});
|
||||
var tin = turf.tin(points, 'z');
|
||||
var promise = Cesium.GeoJsonDataSource.load(tin, {});
|
||||
promise.then(function (dataSource) {
|
||||
viewer.dataSources.add(dataSource);
|
||||
var entities = dataSource.entities.values;
|
||||
for (var o = 0; o < entities.length; o++) {
|
||||
var r = entities[o];
|
||||
r.polygon.material = Cesium.Color.fromRandom({
|
||||
alpha: 0.7
|
||||
});
|
||||
}
|
||||
});
|
||||
viewer.flyTo(promise);
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -1043,11 +1043,23 @@ var exampleConfig = {
|
||||
thumbnail: "8.1.1、叠加分析.jpg",
|
||||
fileName: "8.1.1、叠加分析"
|
||||
},
|
||||
{
|
||||
name: "8.1.2、泰森多边形",
|
||||
name_en: "8.1.2、泰森多边形",
|
||||
thumbnail: "8.1.2、泰森多边形.jpg",
|
||||
fileName: "8.1.2、泰森多边形"
|
||||
},
|
||||
{
|
||||
name: "8.1.3、等值面",
|
||||
name_en: "8.1.3、等值面",
|
||||
thumbnail: "8.1.5、等值面.jpg",
|
||||
fileName: "8.1.5、等值面"
|
||||
},
|
||||
]
|
||||
},
|
||||
"map11cddd3233231": {
|
||||
name: "8.2、可视化1",
|
||||
name_en: "8.2、可视化1",
|
||||
name: "8.2、可视化",
|
||||
name_en: "8.2、可视化",
|
||||
content: [
|
||||
{
|
||||
name: "8.2.1、kriging",
|
||||
|
BIN
examples/cesiumEx/img/8.1.2、泰森多边形.jpg
Normal file
BIN
examples/cesiumEx/img/8.1.2、泰森多边形.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.5 KiB |
Loading…
Reference in New Issue
Block a user