Files
backend/public/weather_notice/js/weather-winds.js
2024-02-01 09:53:53 +00:00

99 lines
3.2 KiB
JavaScript

if (false) {
$(document).ready(function() {
function initDemoMap() {
var Esri_WorldImagery = L.tileLayer(
// "http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",
// https://api.weather.com/v3/TileServer/tile?product=temp&ts=1610526000&xyz=23:11:5&apiKey=d522aa97197fd864d36b418f39ebb323
"https://maptile.rmto.ir/tile/v1/2/{z}/{x}/{y}"
);
var Esri_DarkGreyCanvas = L.tileLayer(
"http://{s}.sm.mapstack.stamen.com/" +
"(toner-lite,$fff[difference],$fff[@23],$fff[hsl-saturation@20])/" +
"{z}/{x}/{y}.png",
);
var baseLayers = {
Satellite: Esri_WorldImagery,
"Grey Canvas": Esri_DarkGreyCanvas
};
var map = L.map("map2", {
layers: [Esri_WorldImagery]
});
// var layerControl = L.control.layers(baseLayers);
// layerControl.addTo(map);
map.setView([34.620, 52.471], 7);
return {
map: map,
// layerControl: layerControl
};
}
var mapStuff = initDemoMap();
var map = mapStuff.map;
var layerControl = mapStuff.layerControl;
// load data (u, v grids) from somewhere (e.g. https://github.com/danwild/wind-js-server)
// $.getJSON("./js/wind-gbr.json", function(data) {
// var velocityLayer = L.velocityLayer({
// displayValues: true,
// displayOptions: {
// velocityType: "GBR Wind",
// displayPosition: "bottomleft",
// displayEmptyString: "No wind data"
// },
// data: data,
// maxVelocity: 10
// });
// layerControl.addOverlay(velocityLayer, "Wind - Great Barrier Reef");
// });
// $.getJSON("./js/water-gbr.json", function(data) {
// var velocityLayer = L.velocityLayer({
// displayValues: true,
// displayOptions: {
// velocityType: "GBR Water",
// displayPosition: "bottomleft",
// displayEmptyString: "No water data"
// },
// data: data,
// maxVelocity: 0.6,
// velocityScale: 0.1 // arbitrary default 0.005
// });
// layerControl.addOverlay(velocityLayer, "Ocean Current - Great Barrier Reef");
// });
$.getJSON("./js/wind-global.json", function(data) {
var velocityLayer = L.velocityLayer({
displayValues: true,
displayOptions: {
velocityType: "Global Wind",
displayPosition: "bottomleft",
displayEmptyString: "No wind data"
},
data: data,
maxVelocity: 15
});
// layerControl.addOverlay(velocityLayer, "Wind - Global");
map.addLayer(velocityLayer);
});
map.attributionControl.setPrefix("");
map.invalidateSize();
});
// demo map
}