Instantly share code, notes, and snippets.
Last active
March 3, 2020 11:36
-
Star
0
(0)
You must be signed in to star a gist -
Fork
0
(0)
You must be signed in to fork a gist
-
Save hplc/008acedc99c9f0daa9b07d378e411b3c to your computer and use it in GitHub Desktop.
Display coronavirus infected communities of Shenzhn on Amap.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="chrome=1"> | |
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width"> | |
<link rel="shortcut icon" href="https://www.helloit.info/sites/www.helloit.info/files/helloit_0.ico" type="image/vnd.microsoft.icon" /> | |
<style type="text/css"> | |
body,html,#container{ | |
height: 100%; | |
margin: 0px; | |
font:12px Arial; | |
} | |
</style> | |
<title>深圳新型肺炎感染地图(2020年2月6日数据)-helloit.info</title> | |
</head> | |
<body> | |
<div id="container" tabindex="0"></div> | |
<script src="https://webapi.amap.com/maps?v=1.4.15&key=c765de21de3e912694201d30a6e0e0da&plugin=AMap.Geocoder"></script> | |
<script type="text/javascript"> | |
var json = {"\u798f\u7530\u533a":["\u9999\u683c\u91cc\u62c9\u5927\u9152\u5e97","\u5fa1\u9526\u516c\u9986","\u9999\u5c71\u7f8e\u6811\u82d1","\u4e0b\u6885\u6797\u6cb3\u80cc\u6751","\u4e1c\u6d77\u56fd\u9645\u516c\u5bd3","\u56ed\u4e2d\u82b1\u56ed","\u65b0\u4e16\u754c\u4f1f\u745e\u9152\u5e97","\u798f\u6ee8\u65b0\u6751","\u798f\u7965\u88572\u53f71\u680b","\u6885\u6797\u8857\u9053\u5170\u6c5f\u5c71\u7b2c","\u76ca\u7530\u6751","\u666f\u7530\u5317\u666f\u9f99\u5927\u53a6","\u76ca\u7530\u82b1\u56ed","\u7b14\u67b6\u5c71\u516c\u56ed\u5458\u5de5\u5bbf\u820d","\u4e0a\u6b65\u4e2d\u8def\u76db\u590f\u516c\u5bd3","\u83b2\u82b1\u5317\u6751","\u4e0a\u6c99\u4e1c\u6751\u516b\u5df7","\u65b0\u6d32\u56db\u8857\u9999\u6c5f\u897f\u82d1","\u798f\u534e\u8def\u7ef4\u4e5f\u7eb3\u9152\u5e97","\u516b\u5366\u56db\u8def\u610f\u99a8\u5c45","\u666f\u7530\u5929\u5065\u82b1\u56ed","\u798f\u6e2f\u8def\u897f28\u53f7\u9633\u5149\u57ce\u5e02","\u8d8a\u4f17\u5c0f\u533a","\u6c99\u5634\u6751\u4e00\u574a","\u7af9\u5b50\u6797\u8d8a\u6d77\u5bb6\u56ed\u4f9d\u5c71\u9601","\u798f\u4fdd\u8857\u9053\u660e\u6708\u82b1\u56ed\u5c0f\u533a","\u534e\u5f3a\u5317\u8857\u9053\u822a\u82d1\u5927\u53a6\u897f\u5ea7","\u798f\u4fdd\u8857\u9053\u7ea2\u6811\u798f\u82d1\u5c0f\u533a"],"\u5357\u5c71\u533a":["\u8bfa\u5fb7\u5047\u65e5\u82b1\u56ed","\u4e1c\u65b9\u82b1\u56ed","\u6d77\u666f\u5609\u9014\u9152\u5e97","\u96f7\u516c\u5cad\u6751","\u6d77\u6dee\u8def\u4e0e\u6d77\u5929\u4e00\u8def\u4ea4\u754c\u5904\u5de5\u5730\u751f\u6d3b\u533a","\u5927\u51b2\u65b0\u57ce\u82b1\u56ed","\u5357\u5149\u82b1\u56ed","\u6052\u7acb\u5fc3\u6d77\u6e7e\u82b1\u56ed","\u767d\u77f3\u6d32\u4e1c\u56db\u574a","\u767b\u826f\u82b1\u56ed","\u767d\u77f3\u6d32\u65b0\u5802\u82b1\u56ed","\u54c8\u5c14\u6ee8\u5de5\u4e1a\u5927\u5b66(\u6df1\u5733)\u5bbf\u820d\u697c","\u5357\u5c71\u8857\u9053\u5b66\u5e9c\u82b1\u56ed","\u6c99\u6cb3\u8857\u9053\u534e\u4fa8\u57ce\u4e1c\u7ec4\u56e2\u5c0f\u533a","\u86c7\u53e3\u8857\u9053\u8c6a\u65b9\u6cfd\u516c\u5bd3","\u897f\u6d77\u6e7e\u82b1\u56ed","\u540e\u6d77\u96c5\u56ed","\u96cd\u666f\u8f69\u8d4f\u6e56\u9601","\u6851\u6cf0\u4e39\u534e\u5e9c\u4e09\u671f","\u4f73\u5146\u4e1a\u524d\u6d77\u5e7f\u573a","\u9633\u5149\u534e\u827a\u5927\u53a6B\u5ea7","\u4e3d\u5c71\u8def\u897f\u6e56\u6797\u8bed\u5c0f\u533a","\u897f\u4e3d\u9633\u5149\u5de5\u4e1a\u533a","\u86c7\u53e3\u8857\u9053\u6d77\u5883\u754c\u5c0f\u533a","\u5357\u5934\u8857\u9053\u9e92\u9e9f\u82b1\u56ed","\u897f\u4e3d\u8857\u9053\u5fb7\u610f\u540d\u5c45","\u6d77\u5cb8\u660e\u73e0","\u534a\u5c9b\u57ce\u90a6"],"\u5b9d\u5b89\u533a":["\u8363\u6cf0\u56ed","\u65b0\u5b89\u8857\u9053\u7075\u829d\u65b0\u6751","\u5b8f\u53d1\u4e16\u7eaa\u57ce","\u6cf0\u534e\u5546\u4e1a\u57ce","\u65b0\u5b89\u8857\u9053\u7532\u5cb8\u6751","\u6ee1\u4eac\u534e\u4e91\u8457\u82b1\u56ed","\u661f\u66dc\u540d\u57ceB\u680b","\u4e07\u8c61\u65b0\u59292\u671f","\u77f3\u5ca9\u8857\u9053\u4f0a\u9686\u8fbe\u5de5\u4e1a\u56ed","\u5b9d\u5b89\u5927\u9053\u4e0e\u88d5\u5b89\u4e00\u8def\u4ea4\u6c47\u5904\u5361\u7f57\u793e\u533a","\u677e\u5c97\u8857\u9053\u78a7\u5934\u793e\u533a\u534e\u90fd\u516c\u5bd3","\u524d\u6d77\u94c2\u5bd3","\u6d77\u534e\u793e\u533a\u81ea\u7531\u5317\u5c0f\u533a","\u677e\u8302\u00b7\u5fa1\u9f99\u6e7e","\u6df1\u822a\u5e78\u798f\u82b1\u56ed","\u5858\u5c3e\u793e\u533a\u869d\u4e8c\u4f73\u4ed5\u6cf0\u79d1\u6280\u56ed\u5bbf\u820d"],"\u9f99\u5c97\u533a":["\u5e03\u5409\u6d77\u5fc3\u6c47\u798f\u56ed","\u5409\u4fe1\u8857\u5982\u5bb6\u9152\u5e97","\u548c\u78e1\u6751\u548c\u78e1\u8def3\u53f7","\u5d82\u80cc\u6b65\u884c\u8857","\u6842\u82b3\u56ed\u516b\u671f","\u4e2d\u9a8f\u56db\u5b63\u9633\u5149\u4e00\u671f","\u5e73\u6e56\u5c71\u53a6\u793e\u533a\u68a8\u5934\u5ed6","\u62db\u5546\u4f9d\u5c71\u90e1","\u5e03\u5409\u65b0\u4e09\u6751","\u5e03\u5409\u6162\u57ce","\u897f\u73af\u8def\u516b\u7ea61\u8857\u9f99\u5bcc\u82b1\u56ed","\u534e\u7b56\u4e2d\u5fc3\u57ce","\u91d1\u9f99\u8c6a\u5eadB\u680b","\u56de\u9f99\u57d4\u4e07\u79d1\u7ff0\u90bb\u57ce","\u5927\u65cf\u6cb3\u5c71","\u534e\u521b\u4e91\u8f69B\u5ea7","\u79c0\u4e3d\u5c71\u5e84","\u4e2d\u592e\u60a6\u57ce","\u5742\u7530\u8857\u9053\u8354\u56ed\u65b0\u6751\u533a","\u5e73\u6e56\u8857\u9053\u7279\u529b\u5546\u53a6","\u4e2d\u6d77\u5eb7\u57ce","\u9f99\u57ce\u8857\u9053\u4e1c\u65b9\u6c81\u56ed\u5c0f\u533a","\u5e03\u6f9c\u8def\u5c1a\u5cf0\u82b1\u56ed"],"\u5149\u660e\u533a":["\u6a2a\u5cad\u65b0\u6751","\u4f20\u9e92\u5c71","\u65b0\u9642\u5934\u6751\u65b0\u7f8e\u4e00\u6751","\u5b8f\u53d1\u4e0a\u57df","\u85af\u7530\u57d4\u6751\u798f\u5357\u8def\u534e\u4e1a\u82d1"],"\u9f99\u534e\u533a":["\u89c2\u6e56\u8857\u9053\u89c2\u58f9\u57ce","\u6c11\u6cbb\u8857\u9053\u9526\u7ee3\u6c5f\u5357","\u89c2\u6f9c\u8857\u9053\u5e93\u5751\u4e2d\u5fc3\u533a","\u5357\u56fd\u4e3d\u56ed","\u661f\u6cb3\u4e39\u5824","\u6625\u534e\u56db\u5b63\u56ed","\u9f99\u534e\u8857\u9053\u65b0\u534e\u82d12\u671f","\u6c11\u6cbb\u8857\u9053\u4e30\u6cfd\u6e56\u5c71\u5e84","\u6c11\u6cbb\u8857\u9053\u7965\u9f99\u5fa1\u5ead\u5c0f\u533a","\u91d1\u5730\u4e0a\u5858\u9053\u4e00\u671f","\u89c2\u6e56\u8857\u9053\u62db\u5546\u89c2\u56ed","\u534e\u4e1a\u73ab\u7470\u56db\u5b63\u4e8c\u671f"],"\u7f57\u6e56\u533a":["\u6d77\u9e70\u5927\u53a6","\u9e3f\u7fd4\u82b1\u56ed","\u4e2d\u5174\u8def88\u53f7\u6c49\u5ead\u9152\u5e97","\u7fe0\u534e\u82b1\u56ed","\u6ce5\u5c97\u897f\u8def\u81ea\u6765\u6c34\u516c\u53f8\u5927\u9662","\u5408\u6b63\u8363\u60a6\u5e9c","\u68a7\u6850\u5c71\u793e\u533a\u8d64\u6c34\u6d1e\u6751","\u767e\u4ed5\u8fbe\u82b1\u56ed5\u671f","\u5927\u671b\u793e\u533a\u65b0\u7530\u6751"],"\u76d0\u7530\u533a":["\u6c99\u5934\u89d2\u8857\u9053\u4e0a\u4e1c\u6e7e"],"\u576a\u5c71\u533a":["\u576a\u5c71\u8857\u9053\u4e07\u79d1\u91d1\u57df\u7f07\u9999\u5c0f\u533a","\u4e1c\u7eb5\u8def6-3\u53f7"]}; | |
// var obj = JSON.parse(json); | |
// console.log(json); | |
var map = new AMap.Map('container',{resizeEnable: true, zoom: 12, center: [114.057428, 22.60923]}); | |
var markers = []; | |
var geocoder = new AMap.Geocoder({ | |
city: "0755", | |
}); | |
for (var key in json) { | |
console.log(key + " -> " + json[key]); | |
for (var key2 in json[key]) { | |
console.log(key2 + " -> " + json[key][key2]); | |
var community = json[key][key2]; | |
// console.log("A"); | |
console.log(community); | |
geocoder.getLocation(community, function(status, result) { | |
community = this.community; | |
if (status === 'complete'&&result.geocodes.length) { | |
var lnglat = result.geocodes[0].location | |
// alert(lnglat); | |
// console.log("C"); | |
// console.log(community); | |
marker = new AMap.Marker({ | |
icon: 'https://www.helloit.info/sites/default/files/2020/coronavirus.png', | |
position: lnglat, | |
title: community, | |
map: map | |
}); | |
// console.log("B"); | |
// console.log(lnglat); | |
// console.log(community); | |
markers.push(marker); | |
} | |
}.bind(({community: community}))); | |
} | |
} | |
map.setFitView(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment