-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgibs_json_viewer.html
200 lines (165 loc) · 4.95 KB
/
gibs_json_viewer.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<!DOCTYPE html>
<html>
<head>
<title>Antarctic Viewer</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style type="text/css">
html, body, #map {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
font-family: sans-serif;
}
.olControlAttribution {
position: absolute;
bottom: 5px !important;
left: 5px !important;
width: 183px;
}
.time {
position: absolute;
bottom: 30px; !important;
left: 5px !important;
z-index: 9999;
font-size: smaller;
}
.olControlAttribution, .time {
background: white;
opacity: 0.3;
padding: 2px 6px;
z-index: 9999;
}
.olControlScaleLine {
background: white;
opacity: 0.3;
z-index: 9999;
position: absolute;
bottom: 10px !important;
right: 10px !important;
left: auto !important;
padding: 5px 10px;
}
.olControlAttribution:hover, .olControlScaleLine:hover, .time:hover {
opacity: 0.8;
}
a {
color: black;
}
#info {
background-color: white;
padding: 5px;
border: 2px solid red;
position: absolute;
z-index: 10000;
bottom: 10px;
right: 10px;
width: 600px;
}
#info strong {
display: block;
float: left;
width: 100px;
}
#info span {
display: block;
float: left;
}
#info br,
#info h2 {
clear: both;
}
</style>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/proj4js/1.1.0/proj4js-compressed.js"></script>
<script src=http://code.jquery.com/jquery-1.9.1.js></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/openlayers/2.12/OpenLayers.js"></script>
</head>
<body>
<div id="map">
<div class="time">Last Update (of all Tiles): 29.10.2014 18:59:34</div>
</div>
<script type="text/javascript">
Proj4js.defs["EPSG:4326"] = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs";
Proj4js.defs["EPSG:3031"] = "+proj=stere +lat_0=-90 +lat_ts=-71 +lon_0=0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs";
Proj4js.defs["EPSG:900913"] = "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs";
var map = new OpenLayers.Map('map', {
controls: [
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.PanZoomBar(),
new OpenLayers.Control.Attribution(),
new OpenLayers.Control.LayerSwitcher(),
new OpenLayers.Control.ScaleLine(),
new OpenLayers.Control.Permalink({
anchor: true
})
],
projection: "EPSG:3031",
displayProjection: "EPSG:4326"
});
var layer = new OpenLayers.Layer.WMTS({
name: "Terra / MODIS Corrected Reflectance (True Color)",
url: [
"https://map1a.vis.earthdata.nasa.gov/wmts-antarctic/wmts.cgi",
"https://map1b.vis.earthdata.nasa.gov/wmts-antarctic/wmts.cgi",
"https://map1c.vis.earthdata.nasa.gov/wmts-antarctic/wmts.cgi"
],
layer: "MODIS_Aqua_CorrectedReflectance_TrueColor",
style: "",
matrixSet: "EPSG3031_250m",
maxResolution: 8192.0,
numZoomLevels: 6,
maxExtent: [-4194304, -4194304, 4194304, 4194304],
tileSize: new OpenLayers.Size(512, 512),
format: "image/jpeg",
projection: "EPSG:3031",
attribution:
"<a href='http://openlayers.org/two'>" +
"OpenLayers</a>" +
"<a href='https://earthdata.nasa.gov/gibs'>" +
"NASA EOSDIS GIBS</a>" +
"<a href='https://github.com/nasa-gibs/web-examples/blob/release/openlayers2/js/antarctic-epsg3031.js'>" +
"View Source" +
"</a>"
});
layer.mergeNewParams({time: "2013-12-01"});
map.addLayer(layer);
map.setCenter([0, 0], 0);
var tiles = new OpenLayers.Layer.XYZ(
'Polar XYZ',
'http://polar.openstreetmap.de/tiles/${z}/${x}/${y}.png',
{
projection: 'EPSG:3031',
maxExtent: [-3000000,-3000000,3000000,3000000],
attribution: '© <a href="http://www.openstreetmap.org/">OpenStreetMap</a> contributors ' ,
numZoomLevels: 19,
transitionEffect: 'resize'
}
)
map.addLayer(tiles);
var markers = new OpenLayers.Layer.Vector("Markers", {
projection: 'EPSG:4326',
strategies: [new OpenLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol.HTTP({
url: "interesting.json",
format: new OpenLayers.Format.GeoJSON()
})
});
map.addLayer(markers);
var featctl = new OpenLayers.Control.SelectFeature(markers);
map.addControl(featctl);
featctl.activate();
featctl.events.register('featurehighlighted', this, function(e) {
var
pt = e.feature.geometry,
ll = new OpenLayers.LonLat(pt.x, pt.y);
map.setCenter(ll, 11);
});
map.events.register('zoomend', this, function() {
markers.setVisibility(map.zoom < 8);
});
if(!map.getCenter())
map.setCenter(new OpenLayers.LonLat(0, 0)/* despite the class name, these are in EPSG:3031, so 0/0 is actually the pole */, 1);
</script>
</body>
</html>