-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeprecated.html
91 lines (85 loc) · 3.89 KB
/
deprecated.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="Javier Jimenez Shaw">
<style>
thead { font-weight: bold; }
tbody tr:nth-child(odd) { background-color: #EEEEEE; }
</style>
</head>
<body onload="load()">
<h1>ESRI deprecated CRSs in EPSG</h1>
<div id="index">
<div><a href="#ProjectedCoordinateSystems">ProjectedCoordinateSystems</a></div>
<div><a href="#GeographicCoordinateSystems">GeographicCoordinateSystems</a></div>
<div><a href="#VerticalCoordinateSystems">VerticalCoordinateSystems</a></div>
</div>
<div id="tables">
<h2>ProjectedCoordinateSystems</h2>
<table id="ProjectedCoordinateSystems"></table>
<h2>GeographicCoordinateSystems</h2>
<table id="GeographicCoordinateSystems"></table>
<h2>VerticalCoordinateSystems</h2>
<table id="VerticalCoordinateSystems"></table>
</div>
<script>
let urlPrefix = 'https://raw.githubusercontent.com/Esri/projection-engine-db-doc/master/json/';
let cs = [
{ name: 'ProjectedCoordinateSystems', file: 'pe_list_projcs.json' },
{ name: 'GeographicCoordinateSystems', file: 'pe_list_geogcs.json'},
{ name: 'VerticalCoordinateSystems', file: 'pe_list_vertcs.json'},
];
function runit(name, file) {
let url = urlPrefix + file;
fetch(url, {
method: "GET",
})
.then(response => response.json())
.then(data => {
let arr = data[name];
let table = document.querySelector('#' + name + ' > tbody');
let dict = arr.reduce(
function (acc, curr) {
acc[curr.wkid] = Object.keys(curr)
.filter((key) => ['latestWkid', 'name', 'description', 'authority', 'deprecated'].includes(key))
.reduce((accK, curK) => ({ ...accK, [curK]: curr[curK] }), {});
return acc;
}
, {});
let count = 0;
arr.forEach(element => {
if (element.deprecated === "yes" && element.authority === "Esri" &&
element.wkid != element.latestWkid && dict[element.latestWkid] && dict[element.latestWkid].authority === 'EPSG') {
let row = table.insertRow();
row.insertCell().innerHTML = element.wkid;
row.insertCell().innerHTML = element.name;
row.insertCell().innerHTML = element.description;
row.insertCell().innerHTML = element.latestWkid;
row.insertCell().innerHTML = '<a href="https://epsg.org/crs/wkt/id/' +
element.latestWkid + '" target=_blank>EPSG:' + element.latestWkid + '</a>';
count += 1;
}
});
let el = document.createElement('div');
el.innerHTML = 'Count: ' + count;
let t = document.querySelector('#' + name);
t.parentNode.insertBefore(el, t.nextSibling);
});
}
function load() {
cs.forEach(s => {
let tb = document.querySelector('#' + s.name);
let header = tb.createTHead();
let row = header.insertRow();
['ESRI code', 'ESRI name', 'Description', 'EPSG code', 'EPSG link'].forEach(e => row.insertCell().innerHTML = e);
let tblBody = document.createElement('tbody');
tb.appendChild(tblBody);
});
cs.forEach(s => runit(s.name, s.file));
}
</script>
</body>
</html>