-
Notifications
You must be signed in to change notification settings - Fork 0
/
mesonet-map-inc.php
355 lines (321 loc) · 12.6 KB
/
mesonet-map-inc.php
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
<?php
############################################################################
# Main processing for Affiliated Regional Networks Global Google Map
#
# Version 3.00 - 24-Jul-2016 - initial release for Google Maps V3 API
# Version 3.01 - 26-Jul-2016 - fixes for override zoom/center for default map
# Version 3.03 - 31-Jul-2016 - added CBI Fire Danger display functions to table, map labels and popups
# Version 4.00 - 23-May-2018 - rewrite to use Leaflet/OpenStreetMaps+others for map display
#
# note: settings for this script should be done in mesonet-map-settings.php, not here.
############################################################################
$RMNETVersion = "Version 4.00 - 23-May-2018";
if (isset($_REQUEST['sce']) && strtolower($_REQUEST['sce']) == 'view' ) {
//--self downloader --
$filenameReal = __FILE__;
$download_size = filesize($filenameReal);
header('Pragma: public');
header('Cache-Control: private');
header('Cache-Control: no-cache, must-revalidate');
header("Content-type: text/plain");
header("Accept-Ranges: bytes");
header("Content-Length: $download_size");
header('Connection: close');
readfile($filenameReal);
exit;
}
print "<!-- mesonet-map-inc.php - $RMNETVersion -->\n";
$doRotatingLegends = true; // =true for rotating legends (much slower display)
global $DebugNetLoad;
require_once("mesonet-map-settings.php");
print $Debug;
$Debug = '';
print $DebugNetLoad;
print "<!-- masterCacheURL='$masterCacheURL' -->\n";
print "<!-- masterConfigURL='$masterConfigURL' -->\n";
print "<!-- NetLookup[".M_NETID."] \n".print_r($NetLookup[M_NETID],true)." -->\n";
// First, generate the embedded JavaScript for the map+pins
if(!$rmMapUseDefaults) {
print "<!-- using custom ".M_NETID." zoom=$rmMapZoom center=$rmMapCenter -->\n";
} else {
print "<!-- using default ".M_NETID." zoom=$rmMapZoom center=$rmMapCenter -->\n";
}
?>
<div class="tabber" style="width: 99%; margin: 0 auto;"><!-- MAP tab begin -->
<div class="tabbertab" style="padding: 0;">
<h2><?php langtrans(M_NETID); ?></h2>
<div style="width: 99%;">
<div id="RMNETmap-container">
<div id="RMNETmap"></div>
<table width="100%" style="border: none">
<tr>
<?php if($doRotatingLegends) { ?>
<td style="width: 180px">
<form action="#">
<div id="RMNETcontrols">
<input type="button" value="<?php echo RMNET_RUN; ?>" name="run" onclick="RMNET_set_run(1);" />
<input type="button" value="<?php echo RMNET_PAUSE; ?>" name="pause" onclick="RMNET_set_run(0);" />
<input type="button" value="<?php echo RMNET_STEP; ?>" name="step" onclick="RMNET_step_content();" />
</div>
</form>
<?php } else { ?>
<td>
<?php } // end no rotating legends ?>
</td>
<?php if($doRotatingLegends) { ?>
<td style="text-align: center;">
<div id="RMNETlegend">
<span class="RMNETcontent0" style="text-align: left;"><?php echo RMNET_TEMPL; ?> [ <span id="curTempUOM"><?php print $rmTempUOM; ?></span>° ]</span>
<span class="RMNETcontent1" style="text-align: left;"><?php echo RMNET_DEWPT; ?> [ <span id="curTempUOM2"><?php print $rmTempUOM; ?></span>° ]</span>
<span class="RMNETcontent2" style="text-align: left;"><?php echo RMNET_HUML; ?> [ % ]</span>
<span class="RMNETcontent3" style="text-align: left;"><?php echo RMNET_WIND; ?> [ <span id="curWindUOM"><?php print $rmWindUOM; ?></span> ]</span>
<span class="RMNETcontent4" style="text-align: left;"><?php echo RMNET_PRECIPSL; ?> [ <span id="curRainUOM"><?php print $rmRainUOM; ?></span> ]</span>
<span class="RMNETcontent5" style="text-align: left;"><?php echo RMNET_BAROB; ?> [ <span id="curBaroUOM"><?php print $rmBaroUOM; ?></span> ]</span>
<!-- <span class="RMNETcontent6" style="text-align: left;"><?php echo RMNET_BAROT; ?></span> -->
<?php if($rmShowFireDanger) { ?>
<span class="RMNETcontent6" style="text-align: left;"><?php
echo preg_replace('|<[^>]+>|',' ',RMNET_CBILEGEND); ?></span>
<?php }// end ShowFireDanger headings ?>
</div>
<?php } else { ?>
<td>
<?php } // end no rotating legends ?>
</td>
<td style="text-align:right;">
<form action="#">
<div id="RMNETcontrolsUOM">
<select id="selTemp" name="selTemp" onchange="RMNET_ChangeSelTemp(this.value);">
<?php
foreach (array('C','F') as $i => $val) {
if($val == $rmTempUOM) {
print " <option value=\"$val\" selected=\"selected\">°$val</option>\n";
} else {
print " <option value=\"$val\">°$val</option>\n";
}
}
?>
</select>
<select id="selWind" name="selWind" onchange="RMNET_ChangeSelWind(this.value);">
<?php
foreach (array('km/h','mph','m/s','kts') as $i => $val) {
if($val == $rmWindUOM) {
print " <option value=\"$val\" selected=\"selected\">$val</option>\n";
} else {
print " <option value=\"$val\">$val</option>\n";
}
}
?>
</select>
<select id="selRain" name="selRain" onchange="RMNET_ChangeSelRain(this.value);">
<?php
foreach (array('mm','in') as $i => $val) {
if($val == $rmRainUOM) {
print " <option value=\"$val\" selected=\"selected\">$val</option>\n";
} else {
print " <option value=\"$val\">$val</option>\n";
}
}
?>
</select>
<select id="selBaro" name="selBaro" onchange="RMNET_ChangeSelBaro(this.value);">
<?php
foreach (array('hPa','inHg','mb') as $i => $val) {
if($val == $rmBaroUOM) {
print " <option value=\"$val\" selected=\"selected\">$val</option>\n";
} else {
print " <option value=\"$val\">$val</option>\n";
}
}
?>
</select>
</div>
</form>
</td>
</tr>
</table>
</div>
<noscript><b>JavaScript must be enabled in order for you to use Google Maps.</b>
However, it seems JavaScript is either disabled or not supported by your browser.
To view Google Maps, enable JavaScript by changing your browser options, and then
try again.
</noscript>
<p><small>[<img src="./MESO-images/mma_20_red.png" height="20" width="12" alt="<?php echo RMNET_lang_stationfeatures('Weather, Webcam, Lightning'); ?>" style="vertical-align:middle"/>] <?php echo RMNET_lang_stationfeatures('Weather, Lightning, WebCam'); ?>,
[<img src="./MESO-images/mma_20_yellow.png" height="20" width="12" alt="<?php echo RMNET_lang_stationfeatures('Weather, Lightning'); ?>" style="vertical-align:middle"/>] <?php echo RMNET_lang_stationfeatures('Weather, Lightning'); ?>,
[<img src="./MESO-images/mma_20_green.png" height="20" width="12" alt="<?php echo RMNET_lang_stationfeatures('Weather, Webcam'); ?>" style="vertical-align:middle"/>] <?php echo RMNET_lang_stationfeatures('Weather, WebCam'); ?>,
[<img src="./MESO-images/mma_20_blue.png" height="20" width="12" alt="<?php echo RMNET_lang_stationfeatures('Weather'); ?>" style="vertical-align:middle"/>] <?php echo RMNET_lang_stationfeatures('Weather'); ?></small>
<span style="width: 25px; height: 25px; background-color: rgba(110, 204, 57, 0.6); border-radius: 10px;"> </span> <?php langtrans("Cluster - click to expand details"); ?></p>
<?php
include_once("mesonet-map-genjs-inc.php");
if(file_exists("mesonet-map-genhtml-inc.php")) {
$doIncludeRMNET = true;
$doPrintRMNET = false;
include_once("mesonet-map-genhtml-inc.php");
if(isset($RMNET_CondsDates)) { print $RMNET_CondsDates; }
}
?>
</div> <!-- end map display area tab -->
<?php print "<!-- $RMNETVersion; -->\n";
$sTarget = $doLinkTarget?' target="_blank"':'';
?>
<p><small>Regional mesonet-map script by
<a href="https://saratoga-weather.org/scripts-mesonet-map.php"<?php echo $sTarget; ?>>Saratoga-Weather.org</a></small></p>
</div> <!-- end first tab -->
<?php
// generate the rest of the tabs
if(file_exists("mesonet-map-genhtml-inc.php")) {
if ($tabHeight <> false) {
$tabHeight = 'height: '.$tabHeight.'px;';
} else {
$tabHeight = '';
}
?>
<div class="tabbertab" style="padding: 0; <?php echo $tabHeight; ?>"><!-- begin second tab -->
<h3><?php echo RMNET_CONDL ?></h3>
<div style="width: 99%;">
<?php
print $Debug;
print $RMNET_CondsDates;
print $RMNET_table;
?>
</div><!-- end conditions include -->
</div><!-- end second tab -->
<?php
if($RMNET_ListHTML <> '') {
$featLegend = preg_replace('|<[^>]+>|',' ',RMNET_FEAT);
?>
<div class="tabbertab" style="padding: 0; <?php echo $tabHeight; ?>"><!-- begin third tab -->
<h3><?php echo $featLegend ?></h3>
<div style="width: 99%;">
<?php print $RMNET_ListHTML; ?>
</div><!-- end station list include -->
</div><!-- end third tab -->
<?php
}
?>
<div class="tabbertab" style="padding: 0; <?php echo $tabHeight; ?>"><!-- begin fourth tab -->
<h3><?php langtrans("Regional Mesonets"); ?></h3>
<div style="width: 99%;">
<ul>
<?php
$StationsIn = 'Stations in';
$lastGeo = '';
$sTarget = $doLinkTarget?' target="_blank"':'';
$langArg = ($Lang <> 'en')?'&lang='.$Lang:'';
foreach ($Networks as $key => $rec) {
list($GeoRegion,$NetID) = explode("\t",$key);
list($NetName,$NetLongName,$NetHomeURL,$GeoAbbrev,$Coverage,$MapWH,$MapOffset,$MesoURL)
= explode("\t",$rec);
$NetHomeURL = htmlspecialchars($NetHomeURL);
if($lastGeo <> $GeoRegion) {
if ($lastGeo) { print " </ul> </li>\n"; }
print " <li><strong>".langtransstr($GeoRegion)."</strong>\n";
print " <ul>\n";
$lastGeo = $GeoRegion;
}
print " <li><a href=\"$NetHomeURL\"$sTarget><strong>" . langtransstr($NetLongName) .
"</strong></a> ($NetID)" . " " .
langtransstr($StationsIn)." ".langtransstr($Coverage)."</li>\n";
}
print " </ul>\n </li>\n</ul><!-- list end -->\n";
?>
<p>Regional Networks created by <a href="https://saratoga-weather.org/"<?php echo $sTarget; ?>>Saratoga-Weather.org</a> along with the Global Afilliated Regional Networks hub site at <a href="http://www.northamericanweather.net/"<?php echo $sTarget; ?>>NorthAmericanWeather.net</a>.
[<a href="http://www.northamericanweather.net/about.php"<?php echo $sTarget; ?>>About</a>]</p>
</div><!-- end Regional Mesonet list include -->
</div><!-- end fourth tab -->
<?php
} // end display of tabs 2, 3, 4
?>
</div><!-- end tabs display -->
<?php
# ------------- functions ---------------------------------------------------
function RMNET_genTranslate() {
// Generate the JavaScript lookups for wind, features, Baro Trend, Conditions from
// the associated [netid]-meso-lang-LL.txt configuration file.
$txtdir = array(
'N' => 'N',
'NNE' => 'NNE',
'NE' => 'NE',
'ENE' => 'ENE',
'E' => 'E',
'ESE' => 'ESE',
'SE' => 'SE',
'SSE' => 'SSE',
'S' => 'S',
'SSW' => 'SSW',
'SW' => 'SW',
'WSW' => 'WSW',
'W' => 'W',
'WNW' => 'WNW',
'NW' => 'NW',
'NNW' => 'NNW',
);
foreach ($txtdir as $key) {
print " langTransLookup['$key'] = '".RMNET_lang_winddir($key)."';\n";
}
$txtbarot = array(
'Rising' => 'Rising',
'Falling' => 'Falling',
'Rising Rapidly' => 'Rising Rapidly',
'Falling Rapidly' => 'Falling Rapidly',
'Rising Slowly' => 'Rising Slowly',
'Falling Slowly' => 'Falling Slowly',
'Steady' => 'Steady'
);
foreach ($txtbarot as $key) {
print " langTransLookup['$key'] = '".RMNET_lang_barotrend($key)."';\n";
}
$txtfeat = array(
'Weather, Lightning, WebCam' => 'Weather, WebCam, Lightning',
'Weather, WebCam, Lightning' => 'Weather, WebCam, Lightning',
'Weather, WebCam' => 'Weather, WebCam',
'Weather, Lightning' => 'Weather, Lightning',
'Weather' => 'Weather'
);
foreach ($txtfeat as $key) {
print " langTransLookup['$key'] = '".RMNET_lang_stationfeatures($key)."';\n";
}
$txticon = array(
'Sunny' => 'Sunny',
'Clear' => 'Clear',
'Cloudy' => 'Cloudy',
'Cloudy2' => 'Cloudy2',
'Partly Cloudy' => 'Partly Cloudy',
'Dry' => 'Dry',
'Fog' => 'Fog',
'Haze' => 'Haze',
'Heavy Rain' => 'Heavy Rain',
'Mainly Fine' => 'Mainly Fine',
'Mist' => 'Mist',
'Fog' => 'Fog',
'Heavy Rain' => 'Heavy Rain',
'Overcast' => 'Overcast',
'Rain' => 'Rain',
'Showers' => 'Showers',
'Snow' => 'Snow',
'Thunder' => 'Thunder',
'Overcast' => 'Overcast',
'Partly Cloudy' => 'Partly Cloudy',
'Rain' => 'Rain',
'Rain2' => 'Rain2',
'Showers2' => 'Showers2',
'Sleet' => 'Sleet',
'Sleet Showers' => 'Sleet Showers',
'Snow' => 'Snow',
'Snow Melt' => 'Snow Melt',
'Snow Showers2' => 'Snow Showers2',
'Sunny' => 'Sunny',
'Thunder Showers' => 'Thunder Showers',
'Thunder Showers2' => 'Thunder Showers2',
'Thunder Storms' => 'Thunder Storms',
'Tornado' => 'Tornado',
'Windy' => 'Windy',
'Stopped Raining' => 'Stopped Raining',
'Wind/Rain' => 'Wind/Rain'
);
foreach ($txticon as $key) {
$t = str_replace("'","\'",RMNET_lang_WXconds($key));
print " langTransLookup['$key'] = '$t';\n";
}
return;
}
?>