Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First pass at adding a OpenWeatherMap based weather map.
- Loading branch information
Showing
6 changed files
with
138 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/** | ||
* OpenWeatherMap layer (See http://openweathermap.org/tile_map#list) | ||
* | ||
* Copyright 2015 Horde LLC (http://www.horde.org/) | ||
* | ||
* See the enclosed file COPYING for license information (GPL). If you | ||
* did not receive this file, see http://www.fsf.org/copyleft/gpl.html. | ||
* | ||
* @author Michael J. Rubinsky <mrubinsk@horde.org> | ||
* | ||
*/ | ||
HordeMap.Owm = Class.create( | ||
{ | ||
initialize: function(opts) | ||
{ | ||
}, | ||
|
||
getLayers: function(layer) | ||
{ | ||
return { | ||
'clouds': new OpenLayers.Layer.XYZ( | ||
'OpenWeatherMap Cloud Map', | ||
['http://${s}.tile.openweathermap.org/map/clouds/${z}/${x}/${y}.png'], | ||
{ | ||
'isBaseLayer': false, | ||
'sphericalMercator': true, | ||
'opacity': 0.7 | ||
} | ||
), | ||
'precipitation': new OpenLayers.Layer.XYZ( | ||
'OpenWeatherMap Precipitation Map', | ||
['http://${s}.tile.openweathermap.org/map/precipitation/${z}/${x}/${y}.png'], | ||
{ | ||
'isBaseLayer': false, | ||
'sphericalMercator': true, | ||
'opacity': 0.7 | ||
} | ||
), | ||
'rain': new OpenLayers.Layer.XYZ( | ||
'OpenWeatherMap Rain Map', | ||
['http://${s}.tile.openweathermap.org/map/rain/${z}/${x}/${y}.png'], | ||
{ | ||
'isBaseLayer': false, | ||
'sphericalMercator': true, | ||
'opacity': 0.7 | ||
} | ||
), | ||
'snow': new OpenLayers.Layer.XYZ( | ||
'OpenWeatherMap Snow Map', | ||
['http://${s}.tile.openweathermap.org/map/snow/${z}/${x}/${y}.png'], | ||
{ | ||
'isBaseLayer': false, | ||
'sphericalMercator': true, | ||
'opacity': 0.7 | ||
} | ||
), | ||
'pressure_cntr': new OpenLayers.Layer.XYZ( | ||
'OpenWeatherMap Sea-Level Pressure Map', | ||
['http://${s}.tile.openweathermap.org/map/pressure_cntr/${z}/${x}/${y}.png'], | ||
{ | ||
'isBaseLayer': false, | ||
'sphericalMercator': true, | ||
'opacity': 0.7 | ||
} | ||
), | ||
'wind': new OpenLayers.Layer.XYZ( | ||
'OpenWeatherMap Wind Map', | ||
['http://${s}.tile.openweathermap.org/map/wind/${z}/${x}/${y}.png'], | ||
{ | ||
'isBaseLayer': false, | ||
'sphericalMercator': true, | ||
'opacity': 0.7 | ||
} | ||
) | ||
}; | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
var WeatherBlockMap = { | ||
|
||
// Map | ||
initializeMap: function(instance, point) | ||
{ | ||
if (this.mapInitialized) { | ||
return; | ||
} | ||
var layers = []; | ||
var p = new HordeMap.Owm(); | ||
$H(p.getLayers()).values().each(function(e) { | ||
if (e.name == 'OpenWeatherMap Wind Map') { | ||
e.visibility = false; | ||
} | ||
console.log(e); | ||
layers.push(e); | ||
}); | ||
p = new HordeMap.Osm(); | ||
$H(p.getLayers()).values().each(function(e) { | ||
e.displayInLayerSwitcher = false; | ||
layers.push(e); | ||
}); | ||
|
||
var map = new HordeMap.Map['Horde']({ | ||
elt: 'weathermaplayer_' + instance, | ||
layers: layers | ||
}); | ||
|
||
map.display(); | ||
map.setCenter(point, 7); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters