Skip to content

Commit 938db47

Browse files
committed
openlayers 新增地震数据可视化范例(heatmap+echarts) review by zhurc
1 parent 55e0355 commit 938db47

File tree

10 files changed

+86874
-5
lines changed

10 files changed

+86874
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@
172172

173173
- 新增`echarts`可视化相关示例
174174

175+
- 新增地震数据可视化示例
176+
175177
### for MapboxGL
176178

177179
- 新增几何要素批量空间分析示例

dist/include-openlayers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
inputScript("http://cdn.bootcss.com/echarts/4.0.4/echarts.min.js");
5656
}
5757
if (inArray(includes, 'ol3-echarts')) {
58-
inputScript("https://cdn.jsdelivr.net/npm/ol3-echarts/dist/ol3Echarts.js");
58+
inputScript("http://iclient.supermap.io/libs/openlayers/ol3-echarts/ol3Echarts.js");
5959
}
6060
if (inArray(includes, 'osmbuildings')) {
6161
inputScript("http://iclient.supermap.io/libs/osmbuildings/OSMBuildings-OL3.js");

examples/data/chinaEarthquake.csv

Lines changed: 86438 additions & 0 deletions
Large diffs are not rendered by default.

examples/locales/en-US/resources.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,8 @@ window.resources = {
451451
"title_vectorTileLayerNight": "Night Style of SuperMap REST Vector Layer",
452452
"title_vectorTileLayerNormal": "Vector Layer of SuperMap REST",
453453
"title_iportalWebMap": "SuperMap iPortal Map",
454-
454+
"title_earthquakeHeatMapLayer":"Earthquake occurrences(2005-2016)(Classic)",
455+
"title_echartsEarthquake":"Earthquake occurrences(2005-2016)",
455456

456457
"text_code": "Forward Match",
457458
"text_decode": "Reverse Match",
@@ -1067,7 +1068,12 @@ window.resources = {
10671068
"text_proportionAnimation": "Proportional animation",
10681069
"text_SHAnimation": "Show/hidden animation",
10691070
"text_pathAnimation": "Path animation",
1070-
1071+
"text_echartsEarthquake_title":"Earthquake occurrences from 2005 to 2016",
1072+
"text_echartsEarthquake_sub_title":"units: times",
1073+
"text_quarter_1":"Quarter 1",
1074+
"text_quarter_2":"Quarter 2",
1075+
"text_quarter_3":"Quarter 3",
1076+
"text_quarter_4":"Quarter 4",
10711077

10721078
"btn_overlayAnalyst": "Start analysis",
10731079
"btn_terrainCurvatureCalculation": "Start calculation",

examples/locales/zh-CN/resources.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,8 @@ window.resources = {
451451
"title_vectorTileLayerNight":"SuperMap REST 月夜风格矢量底图",
452452
"title_vectorTileLayerNormal":"SuperMap REST 矢量瓦片",
453453
"title_iportalWebMap":"SuperMap iPortal地图",
454-
454+
"title_earthquakeHeatMapLayer":"2005-2016地震次数(Classic)",
455+
"title_echartsEarthquake":"2005到2016年地震发生情况",
455456

456457
"text_code": "正向匹配",
457458
"text_decode": "反向匹配",
@@ -1067,7 +1068,12 @@ window.resources = {
10671068
"text_proportionAnimation":"比例动画",
10681069
"text_SHAnimation":"显隐动画",
10691070
"text_pathAnimation":"路径动画",
1070-
1071+
"text_echartsEarthquake_title":"2005到2016年地震发生情况",
1072+
"text_echartsEarthquake_sub_title":"单位:次数",
1073+
"text_quarter_1":"第一季度",
1074+
"text_quarter_2":"第二季度",
1075+
"text_quarter_3":"第三季度",
1076+
"text_quarter_4":"第四季度",
10711077

10721078
"btn_overlayAnalyst": "叠加分析",
10731079
"btn_terrainCurvatureCalculation": "地形曲率计算",

examples/openlayers/config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,11 @@ var exampleConfig = {
493493
name_en: "random points (Classic)",
494494
thumbnail: "ol_heatMapLayer.png",
495495
fileName: "heatMapLayer"
496+
},{
497+
name: "2005-2016地震次数(Classic)",
498+
name_en: "earthquake occurrences(2005-2016)(classic)",
499+
thumbnail: "ol_earthquakeHeatMapLayer.png",
500+
fileName:'earthquakeHeatMapLayer'
496501
}]
497502
},
498503
"cluster": {
@@ -616,6 +621,13 @@ var exampleConfig = {
616621
name_en: "cell map",
617622
thumbnail: "ol_echartsCellMap.png",
618623
fileName: "echartsCellMap"
624+
},
625+
{
626+
name: "2005到2016年地震发生情况",
627+
name_en: "Earthquake occurrences(2005-2016)",
628+
thumbnail: "ol_echartsEarthquake.png",
629+
fileName: "echartsEarthquake"
630+
619631
}
620632
]
621633
},
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
7+
<title data-i18n="resources.title_earthquakeHeatMapLayer"></title>
8+
<script type="text/javascript" src="../../dist/include-openlayers.js"></script>
9+
<style>
10+
body {
11+
margin: 0;
12+
overflow: hidden;
13+
background: #fff;
14+
width: 100%;
15+
height: 100%
16+
}
17+
18+
#map {
19+
position: absolute;
20+
width: 100%;
21+
height: 100%;
22+
border: 1px solid #3473b7;
23+
}
24+
</style>
25+
</head>
26+
27+
<body>
28+
<div id="map"></div>
29+
<script type="text/javascript" include="jquery,papaparse" src="../js/include-web.js"></script>
30+
<script type="text/javascript">
31+
var host = window.isLocal ? window.server : "http://support.supermap.com.cn:8090";
32+
var url = host + "/iserver/services/map-world/rest/maps/World";
33+
var map;
34+
map = new ol.Map({
35+
target: 'map',
36+
controls: ol.control.defaults({ attributionOptions: { collapsible: false } }),
37+
view: new ol.View({
38+
center: [0, 0],
39+
zoom: 2,
40+
projection: 'EPSG:4326'
41+
})
42+
});
43+
var iserverWorldLayer = new ol.layer.Tile({
44+
source: new ol.source.TileSuperMapRest({
45+
url: url,
46+
wrapX: true
47+
}),
48+
projection: 'EPSG:4326'
49+
});
50+
map.addLayer(iserverWorldLayer);
51+
52+
53+
//加载热力图
54+
var radius = 15, heatFeatures = [], heatMapSource, heatMapLayer;
55+
$.get('../data/chinaEarthquake.csv', function (csvstr) {
56+
var data = Papa.parse(csvstr, { skipEmptyLines: true, header: true }).data;
57+
for (var i = 0; i < data.length; i++) {
58+
if (data[i].Y <= 85) {
59+
heatFeatures.push(new ol.Feature({
60+
geometry: new ol.geom.Point([data[i].X, data[i].Y]),
61+
Properties: { "value": data[i].level / 50 }
62+
}))
63+
}
64+
};
65+
heatMapSource = new ol.source.HeatMap("heatMap", {
66+
"map": map,
67+
"id": "heatmap",
68+
"radius": radius,
69+
//权重
70+
"featureWeight": "value",
71+
});
72+
heatMapSource.addFeatures(heatFeatures);
73+
heatMapLayer = new ol.layer.Image({
74+
source: heatMapSource
75+
});
76+
map.addLayer(heatMapLayer);
77+
});
78+
79+
80+
</script>
81+
</body>
82+
83+
</html>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy