Skip to content

Commit 29365e8

Browse files
committed
leaflet 新增地震数据热力图可视化范例 review by zhurc
1 parent b576c1d commit 29365e8

File tree

6 files changed

+85
-1
lines changed

6 files changed

+85
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,10 @@
161161

162162
- 新增可视化纽约出租车18万点图片示例
163163

164-
- 修复 `05_findPathService.html` 例子显示错误的问题
164+
- 新增2w+地震数据热力图可视化范例
165+
166+
- 修复 `05_findPathService.html` 例子显示错误的问题
167+
165168

166169
### for OpenLayers
167170

examples/leaflet/config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,11 @@ var exampleConfig = {
544544
name_en: "random points (Classic)",
545545
thumbnail: "l_heatMapLayer.png",
546546
fileName: "heatMapLayer"
547+
},{
548+
name: "2000年到2015年地震热力图(Classic)",
549+
name_en: "Earthquake heat map (2000-2015)",
550+
thumbnail: "l_earthquakeHeatMap.png",
551+
fileName: "earthquakeHeatMap"
547552
}]
548553
},
549554
"animate": {
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8">
5+
<title data-i18n="resources.title_l_echartsEarthquake"></title>
6+
<script type="text/javascript" include="papaparse,jquery" src="../js/include-web.js"></script>
7+
</head>
8+
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
9+
<div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
10+
<script type="text/javascript" src="../../dist/include-leaflet.js"></script>
11+
<script type="text/javascript">
12+
13+
var host = "http://support.supermap.com.cn:8090";
14+
var url = host + "/iserver/services/map-china400/rest/maps/China";
15+
16+
var map, heatMapLayer;
17+
18+
map = L.map('map', {
19+
center: [32.67, 109.06],
20+
zoom: 5
21+
});
22+
L.supermap.tiledMapLayer(url).addTo(map);
23+
24+
addHeatMapLayer();
25+
26+
function addHeatMapLayer() {
27+
heatMapLayer = L.supermap.heatMapLayer("heatMap", {
28+
id: "heatmap",
29+
map: map,
30+
radius: 10,
31+
featureWeight: "value"
32+
}
33+
);
34+
35+
$.get("../data/chinaEarthquake.csv", function (response) {
36+
var dataObj = Papa.parse(response, {skipEmptyLines: true, header: true});
37+
38+
var data = dataObj.data;
39+
40+
var geojson = {
41+
"type": "FeatureCollection",
42+
"features": []
43+
};
44+
45+
46+
for (var i = 0; i < data.length; i++) {
47+
var item = data[i];
48+
var date = new Date(item.date);
49+
var year = date.getFullYear();
50+
51+
//2w+地震数据
52+
if (year > 2000 && year < 2015) {
53+
var feature = {
54+
"type": "feature",
55+
"geometry": {
56+
"type": "Point",
57+
"coordinates": []
58+
},
59+
"properties": {
60+
"value": parseFloat(item.level)
61+
}
62+
};
63+
feature.geometry.coordinates = [parseFloat(item.X), parseFloat(item.Y)];
64+
65+
geojson.features.push(feature);
66+
}
67+
}
68+
heatMapLayer.addFeatures(geojson);
69+
heatMapLayer.addTo(map);
70+
});
71+
}
72+
</script>
73+
</body>
74+
</html>
27.8 KB
Loading

examples/locales/en-US/resources.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@ window.resources = {
453453
"title_iportalWebMap": "SuperMap iPortal Map",
454454
"title_earthquakeHeatMapLayer":"Earthquake occurrences(2005-2016)(Classic)",
455455
"title_echartsEarthquake":"Earthquake occurrences(2005-2016)",
456+
"title_l_echartsEarthquake":"Earthquake heat map (2000-2015)",
456457

457458
"text_code": "Forward Match",
458459
"text_decode": "Reverse Match",

examples/locales/zh-CN/resources.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@ window.resources = {
453453
"title_iportalWebMap":"SuperMap iPortal地图",
454454
"title_earthquakeHeatMapLayer":"2005-2016地震次数(Classic)",
455455
"title_echartsEarthquake":"2005到2016年地震发生情况",
456+
"title_l_echartsEarthquake":"2000年到2015年地震热力图",
456457

457458
"text_code": "正向匹配",
458459
"text_decode": "反向匹配",

0 commit comments

Comments
 (0)