-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoceanCurrents.html
185 lines (166 loc) · 5.96 KB
/
oceanCurrents.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
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<title>
FlowRenderer with effects and blending | Sample | ArcGIS API for
JavaScript 4.24
</title>
<link rel="stylesheet" href="https://js.arcgis.com/4.27/esri/themes/dark/main.css" />
<script src="https://js.arcgis.com/4.27/"></script>
<!-- Favicon -->
<link rel="icon" type="image/x-icon" href="https://cdn-icons-png.flaticon.com/512/67/67753.png">
<!-- Calcite -->
<script type="module" src="https://js.arcgis.com/calcite-components/1.4.2/calcite.esm.js"></script>
<link rel="stylesheet" type="text/css" href="https://js.arcgis.com/calcite-components/1.4.2/calcite.css" />
<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
background-color: #4c4c4c;
}
</style>
<script>
var view;
require([
"esri/Map",
"esri/views/MapView",
"esri/layers/ImageryTileLayer",
"esri/layers/TileLayer",
"esri/layers/GroupLayer",
"esri/rest/support/MultipartColorRamp",
"esri/rest/support/AlgorithmicColorRamp",
"esri/Color",
"esri/widgets/Legend",
"esri/widgets/Fullscreen",
"esri/widgets/Expand"
], function (
Map,
MapView,
ImageryTileLayer,
TileLayer,
GroupLayer,
MultipartColorRamp,
AlgorithmicColorRamp,
Color,
Legend,
Fullscreen,
Expand
) {
// Mapa base con proyección especial para ver todos los océanos como una única masa de agua
const spilhausBasemap = new TileLayer({
url: "https://tiles.arcgis.com/tiles/nGt4QxSblgDfeJn9/arcgis/rest/services/Spilhaus_Vibrant_Basemap/MapServer",
effect: "saturate(10%) brightness(0.3)" // saturación y brillo del mapa base (tierra)
});
// Los efectos funcionan como filtros de fotos para conseguir diferentes efectos visuales para mejorar la cartografía del mapa
// Crea rampas de colores multipartes para combinar rampas de color en renderers de raster
const colorRamp = new MultipartColorRamp({
colorRamps: [
new AlgorithmicColorRamp({
fromColor: new Color([20, 100, 150, 255]),
toColor: new Color([70, 0, 150, 255])
}),
new AlgorithmicColorRamp({
fromColor: new Color([70, 0, 150, 255]),
toColor: new Color([170, 0, 120, 255])
}),
new AlgorithmicColorRamp({
fromColor: new Color([170, 0, 120, 255]),
toColor: new Color([230, 100, 60, 255])
}),
new AlgorithmicColorRamp({
fromColor: new Color([230, 100, 60, 255]),
toColor: new Color([255, 170, 0, 255])
}),
new AlgorithmicColorRamp({
fromColor: new Color([255, 170, 0, 255]),
toColor: new Color([255, 255, 0, 255])
})
]
});
// sea surface temperature, visualized with raster stretch renderer
const temperatureLayer = new ImageryTileLayer({
url: "https://tiledimageservices.arcgis.com/jIL9msH9OI208GCb/arcgis/rest/services/HyCOM_Surface_Temperature___Spilhaus/ImageServer",
renderer: {
colorRamp,
stretchType: "min-max", // Tramo de menor a mayor
type: "raster-stretch" // RasterStrechRenderer: simbología de rampa gradual de colores para cada píxel en función de su valor
}
});
// ocean currents, visualized with flow renderer
const currentsLayer = new ImageryTileLayer({
url: "https://tiledimageservices.arcgis.com/jIL9msH9OI208GCb/arcgis/rest/services/Spilhaus_UV_ocean_currents/ImageServer",
renderer: {
type: "flow", // autocasts to FlowRenderer
density: 1,
maxPathLength: 10, // Longitud máxima de la la línea
trailWidth: "2px"
},
blendMode: "destination-in" // Modos de fusión para combinar capas. La capa de temperatura se dibuja solo donde se superpone con la capa superior, el resto es transparente.
});
const groupLayer = new GroupLayer({ // Permite organizar subcapas en una capa común
effect: "bloom(2, 0.5px, 0.0)", // Efecto "floración" (intensidad, radio, umbral)
layers: [temperatureLayer, currentsLayer]
});
const map = new Map({
basemap: {
baseLayers: [spilhausBasemap]
},
layers: [groupLayer]
});
view = new MapView({
container: "viewDiv",
map: map,
zoom: 6,
center: [-3.74, 40.42]
});
// add legend for temperature layer
const legend = new Legend({
view: view,
layerInfos: [
{
layer: temperatureLayer,
title: "Temperatura de la superficie marina"
}
]
});
view.ui.add(legend, "top-right");
// add fullscreen widget
fullscreen = new Fullscreen({
view: view
});
view.ui.add(fullscreen, "top-left");
const codeExpand = new Expand({
view: view,
content: document.getElementById("code"),
expanded: false,
expandIconClass: "esri-icon-visible",
collapseIconClass: "esri-icon-non-visible"
});
view.ui.add(codeExpand, "top-left");
});
</script>
</head>
<body>
<div id="viewDiv"></div>
<calcite-card id="code" class="calcite-theme-dark">
<div slot="title">Flow Renderer</div>
<pre style="font-size: 20px;">
const currentsLayer = new ImageryTileLayer({
url: "https://tiledimageservices.arcgis.com/jIL9msH9OI208GCb/arcgis/rest/services/Spilhaus_UV_ocean_currents/ImageServer",
renderer: {
type: "flow", // autocasts to new FlowRenderer
density: 1,
maxPathLength: 10,
trailWidth: "2px"
},
blendMode: "destination-in"
});
</pre>
</calcite-card>
</body>
</html>