README.md 2.46 KB
Newer Older
Tomas Pettersson's avatar
first  
Tomas Pettersson committed
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
# leaflet-weather-control
>


## Description
Displays weather related leaflet tilelayers with time dimension. Syncs with leaflet-player-control. Built with uikit.

![](image.png)

## Installation

You will need node.js, npm and bower for demo

### bower
`bower install https://git.smhi.se/stw/leaflet-weather-control.git --save`

## Demo

Go to demo folder and install package.json

	> npm install

Start server in demo folder

	> node server.js
	Server started on http://localhost:8080...

Open browser on http://localhost:8080/demo


## Usage example

Tomas Pettersson's avatar
Tomas Pettersson committed
33
34
35
36
37
38
39
		var map = L.map('map').setView([ 58.5, 19.0 ], 5);
		L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
			maxZoom : 18,
			attribution : '&copy; <a href="http://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors</a>'
		}).addTo(map);

		var language = 'en';
Tomas Pettersson's avatar
first  
Tomas Pettersson committed
40

Tomas Pettersson's avatar
Tomas Pettersson committed
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
        var player = new L.Control.Player({
            "lang" : language,
            "langdata" : {
		        "tTitle" : "Player" 
    		}
        });
        
        
        var containerControl = new L.Control.Container({
            position: 'topright',
            player: player
        });
        map.addControl(containerControl);     
        
        var domain =  {
Tomas Pettersson's avatar
Tomas Pettersson committed
56
57
58
59
60
				"weather" : [ 
								"SMHI/NEMO/NS02/currentCombined",
								"SMHI/NEMO/NS02/windCombined",
								"SMHI/NEMO/NS02/windDirection",
								"SMHI/NEMO/NS02/iceCombined"  ]
Tomas Pettersson's avatar
Tomas Pettersson committed
61
62
63
64
			};
        
        var weatherLangData = {
				"tTitle" : "Weather",
Tomas Pettersson's avatar
Tomas Pettersson committed
65
66
67
68
69
70
71
72
73
74
75
				"currentCombinedTitle" : "Current arrows with speed",
				"currentSpeedTitle" : "Current speed",
				"windCombinedTitle" : "Wind flags with speed",
				"windDirectionTitle" : "Wind flags",
				"waveCombinedTitle" : "Wave",
				"iceCombinedTitle" : "SST and ice",
				"currentCombined" : "Current speed [knots]",
				"windCombined" : "Windspeed [m/s]",
				"iceCombinedice" : "Ice concentration [%]",
				"iceCombinedsst" : "Sea surface temperature [℃]",
				"waveCombined" : "Height [m]"
Tomas Pettersson's avatar
Tomas Pettersson committed
76
77
78
79
80
81
82
83
84
85
86
87
			};
        
        var stores = [];
        stores.push(new L.Control.SMHILayerStore());      
        
        var weatherControl = new L.Control.Weather(stores, player, {
			"domain" : domain,
			"lang" : language,
			"langdata" : weatherLangData,
			"proxy" : 'proxy'
		});

Tomas Pettersson's avatar
Tomas Pettersson committed
88
		containerControl.addComponent("Forecasts", weatherControl);
Tomas Pettersson's avatar
first  
Tomas Pettersson committed
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109




## Copyright and License

## Contact information

Tomas Pettersson tomas.pettersson@smhi.se


## Credits and acknowledgements


## Known bugs

## Troubleshooting

## Changelog