-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscene.yaml
397 lines (367 loc) · 15.4 KB
/
scene.yaml
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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
import:
- https://www.nextzen.org/carto/refill-style/refill-style.zip
- https://www.nextzen.org/carto/refill-style/themes/color-gray-gold.zip
- https://s3.amazonaws.com/xyz-demo/data/demo.yaml
# - https://www.nextzen.org/carto/refill-style/11/themes/label-6.zip
- https://www.nextzen.org/carto/refill-style/themes/terrain-shading.zip
- https://www.nextzen.org/carto/refill-style/11/themes/terrain-shading-dark.zip
- https://s3.amazonaws.com/xyz-demo/scenes/plasma.yaml
- https://s3.amazonaws.com/xyz-demo/scenes/viridis.yaml
global:
# sdk_bathymetry: true
# color_6: [0,0,1]
# color_5: [.8,0,.5]
# color_4: [1,0,0]
# color_3: [1,.5,0]
# color_2: [1,1,0]
# color_1: [.9,.9,.9]
date: |
function(feature){
var date = feature.acq_date
var time = feature.acq_time
var date = date.replace(/\//g, '-');
var hour = time.slice(0, 2)
var minute = time.slice(2, 4)
var date_string = date + 'T' + hour + ':' + minute + 'Z'
var d = new Date(date_string);
return d
}
local_time: |
function(){
var date = feature.acq_date
var time = feature.acq_time
var sat = feature.satellite
switch(sat) {
case 'N':
sat = "VIIRS\nSuomi NPP"
break
case 'A':
sat = "MODIS\nAqua"
break
case 'T':
sat = "MODIS\nTerra"
break
}
var date = date.replace(/\//g, '-');
var hour = time.slice(0, 2)
var minute = time.slice(2, 4)
var date_string = date + 'T' + hour + ':' + minute + 'Z'
var d = new Date(date_string);
// return date
var options = { weekday: 'short', month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' };
return d.toLocaleDateString('en-US', options) + '\n' + sat + '\n' + feature.confidence
// return d.toDateString() + '\n' + d.getHours() + ':' + d.getMinutes()
}
viridis_color: |
function(hours,window,opacity){
var color_10 = global.viridis_plasma[0]
color_10.push(opacity)
var color_9 = global.viridis_plasma[30]
color_9.push(opacity)
var color_8 = global.viridis_plasma[60]
color_8.push(opacity)
var color_7 = global.viridis_plasma[90]
color_7.push(opacity)
var color_6 = global.viridis_plasma[120]
color_6.push(opacity)
var color_5 = global.viridis_plasma[150]
color_5.push(opacity)
var color_4 = global.viridis_plasma[180]
color_4.push(opacity)
var color_3 = global.viridis_plasma[225]
color_3.push(opacity)
var color_2 = global.viridis_plasma[250]
color_2.push(opacity)
var color_1 = [1,1,1,opacity]
var color_0 = [0,1,0,opacity]
if (hours > window*9){color = color_10}
if (hours < window*9){color = color_9}
if (hours < window*8){color = color_8}
if (hours < window*7){color = color_7}
if (hours < window*6){color = color_6}
if (hours < window*5){color = color_5}
if (hours < window*4){color = color_4}
if (hours < window*3){color = color_3}
if (hours < window*2){color = color_2}
if (hours < window){color = color_1}
return color
}
_viridis_color: |
function(hours,window){
if (hours > window*9){color = global.viridis_plasma[0]}
if (hours < window*9){color = global.viridis_plasma[30]}
if (hours < window*8){color = global.viridis_plasma[60]}
if (hours < window*7){color = global.viridis_plasma[90]}
if (hours < window*6){color = global.viridis_plasma[120]}
if (hours < window*5){color = global.viridis_plasma[150]}
if (hours < window*4){color = global.viridis_plasma[180]}
if (hours < window*3){color = global.viridis_plasma[225]}
if (hours < window*2){color = global.viridis_plasma[250]}
if (hours < window){color = [1,1,1]}
return color
}
modis_temperature: |
function(feature){
var temp = feature.brightness
var color
temp = (temp - 300)
temp = (temp / 270) * 64
if ($zoom > 12){
color = 'hsla(' + temp + ',100%,50%,0.7)'
}
else {
color = [0,0,0,0]
}
return color
}
window: 8 # hours per window
then: [2017,09,18,12] # date string, 0 is jan, 11 is dec
styles:
_text:
base: text
blend_order: 2
_text_high:
base: text
blend_order: 0
_points:
base: points
blend_order: 3
_lines:
base: lines
blend_order: 1
sources:
modis_fires:
# url: https://xyz.api.here.com/hub/spaces/ZOaZln0t/tile/web/{z}_{x}_{y} #2018
url: https://xyz.api.here.com/hub/spaces/HvuuJKQW/tile/web/{z}_{x}_{y} #2019
url_params:
access_token: Ki_CnlGQ_g22rwjBsPs5Bg
clip: true
# tags: modis
# type: GeoJSON
type: GeoJSON
# url: https://s3.amazonaws.com/active-fire-data/modis_latest.geojson
active_perimeters:
type: GeoJSON
url: https://s3.amazonaws.com/active-fire-data/usgs_latest.geojson
generate_label_centroids: true
viirs_7d:
type: GeoJSON
# url: https://xyz.api.here.com/hub/spaces/rrUK6Cb9/tile/web/{z}_{x}_{y} #2018
url: https://xyz.api.here.com/hub/spaces/ZManj2D5/tile/web/{z}_{x}_{y} #2019
url_params:
access_token: Ki_CnlGQ_g22rwjBsPs5Bg
clip: true
# tags: viirs
# url: https://s3.amazonaws.com/active-fire-data/viirs_latest.geojson
perimeters:
type: GeoJSON
url: https://xyz.api.here.com/hub/spaces/iHRmkELz/tile/web/{z}_{x}_{y}
generate_label_centroids: true
url_params:
access_token: Ki_CnlGQ_g22rwjBsPs5Bg
clip: true
_digitalglobe:
url: https://services.digitalglobe.com/mapservice/wmtsaccess?SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile&LAYER=DigitalGlobe:ImageryTileService&featureProfile=Accuracy_Profile&FORMAT=image/png&STYLE=&CONNECTID=1b207260-1627-4a35-945e-089b8cf09f78&TileMatrixSet=EPSG:3857&TileMatrix=EPSG:3857:{z}&TileRow={y}&TileCol={x}
type: Raster
terrain_normals: #make the satellite imagery pop a bit more
type: Raster
url: https://tile.nextzen.org/tilezen/terrain/v1/512/normal/{z}/{x}/{y}.png
tile_size: 512
max_zoom: 14
url_params: { api_key: global.sdk_api_key }
_satellite:
# url: https://1.aerial.maps.api.here.com/maptile/2.1/maptile/newest/terrain.day/{z}/{x}/{y}/512/png
url: https://1.aerial.maps.api.here.com/maptile/2.1/maptile/newest/satellite.day/{z}/{x}/{y}/512/png
type: Raster
rasters: [terrain_normals]
url_params:
app_id: 0VeWPmMuUeMebnjNVGz9
app_code: MVqjbI661R5lC2DqkAZpNg
layers:
_here_sat:
data: {source: _digitalglobe}
filter: {$zoom: {min: 14}}
draw:
raster:
order: 1999 # draw on bottom
_viirs_7d:
# enabled: false
data: { source: viirs_7d }
# filter:
# confidence: nominal
# not: {confidence: low}
draw:
points:
# interactive: true
collide: false
# color: [1,0,0,0.3]
color: |
function() {
var data_date = global.date(feature)
var now = new Date() // for live data
// or set to a previous time/date, 0=jan, 11=dec!
// var now = new Date(2017,09,09)
var hours = Math.abs(now - data_date) / 36e5
var window = global.window // hours per color
var opacity
if ($zoom < 8){opacity = 0.2 }
else if ($zoom > 12) {opacity = 0.4}
else if ($zoom > 7) {opacity = 0.5}
var color = global._viridis_color(hours,window)
color.push(opacity)
return color
}
size: [[10,5px],[13,20px],[14,45px],[15,100px],[17,200px]]
# size: function(){ return 375 * $meters_per_pixel }
# size: function() { return 375/$meters_per_pixel }
outline:
# # color: red
width: 0.5px
color: |
function() {
var data_date = global.date(feature)
var now = new Date() // for live data
// or set to a previous time/date, 0=jan, 11=dec!
// var now = new Date(2017,09,09)
var hours = Math.abs(now - data_date) / 36e5
var window = 12// global.window // hours per color
var opacity = 0.5
// if ($zoom < 8){opacity = 0.2 }
// else if ($zoom > 12) {opacity = 0.3}
// else if ($zoom > 7) {opacity = 0.6}
var color = global._viridis_color(hours,window)
color.push(opacity)
return color
}
labels:
filter: {$zoom: {min: 16}}
draw:
# _points:
text:
style: _text
# optional: false
collide: false
# text_source: function(){return feature.Name}
# text_source: BRIGHT_TI4
text_wrap: 12
text_source: global.local_time
# text_source: |
# function(){
# var date = feature.ACQ_DATE
# var time = feature.ACQ_TIME
# var date = date.replace(/\//g, '-');
# var hour = time.slice(0, 2)
# var minute = time.slice(2, 4)
# var date_string = date + 'T' + hour + ':' + minute + 'Z'
# var d = new Date(date_string);
# // return date
# var options = { weekday: 'short', month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit'};
# return d.toLocaleDateString('en-US', options) + ' (VIIRS)\n' + feature.CONFIDENCE
# // return d.toDateString() + '\n' + d.getHours() + ':' + d.getMinutes()
# }
# text_source: function(){return feature.ACQ_TIME +'\n'+ feature.ACQ_DATE}
font:
style: bold
size: 10px
fill: lightgrey
stroke:
color: black
width: 2px
_modis_latest:
# enabled: false
data: { source: modis_fires}
draw:
points:
collide: false
# size: 10px
size: [[9,10px],[11,30px],[12,40px],[18,140px]]
# color: [1,0,0,0.5]
color: |
function() {
var data_date = global.date(feature)
var now = new Date() // for live data
// or set to a previous time/date, 0=jan, 11=dec!
// var now = new Date(2017,09,09)
var hours = Math.abs(now - data_date) / 36e5
var window = global.window // hours per color
var opacity
if ($zoom < 8){opacity = 0.1 }
else if ($zoom > 12) {opacity = 0.3}
else if ($zoom > 7) {opacity = 0.6}
var color = global._viridis_color(hours,window)
color.push(opacity)
return color
}
outline:
width: 2px
# color: global.modis_temperature(feature)
color: |
function(){
// var opacity = .7
var temp = feature.brightness
temp = (temp - 300)
temp = (temp / 270) * 64
if ($zoom > 13){
return [1,1,1,0.5]
// return 'hsla(' + temp + ',100%,50%,0.7)'
}
else {
return [0,0,0,0]
}
}
# color: | # temperature
# function() {
# var temp = feature.BRIGHTNESS
# temp = (temp - 300)
# temp = (temp / 270) * 64
# // return [temp,0.2,0]
# return 'hsla(' + temp + ',100%,50%,0.6)'
# // temp = temp/400
# // return [temp,0,0]
# }
label:
filter: {$zoom:{min: 15}}
draw:
text:
style: _text_high
optional: true
collide: false
# text_source: function(){return feature.Name}
# text_source: BRIGHTNESS
text_source: global.local_time
font:
style: bold
size: 10px
fill: black
stroke:
color: white
width: 3px
perimeters:
data: {source: active_perimeters}
# data: {source: perimeters}
boundary:
draw:
lines:
# color: red
color: [1,0,0,0.7]
width: 1px
order: 2000
labels:
filter: {label_placement: true}
draw:
_text_high:
optional: false
text_source: |
function(){
var firename = feature.FIRENAME || feature.FIRE_NT_NM
return firename + " FIRE"
}
font:
# transform: uppercase
transform: lowercase
style: bold
size: 10px
fill: [0,0,0,0.7]
stroke:
color: [1,1,1,0.8]
width: 3px