Commit 62341bcb authored by Tomas Pettersson's avatar Tomas Pettersson 🏸

added a fcoo test layer

Updated FCOO wms layer by getting reftime as default time
parent 28a67c5e
......@@ -43,7 +43,7 @@ module.exports = function(grunt) {
overrides : {
"L.TimeDimension.layer.weather" : {
"main" : [
"src/L.TimeDimension.layer.wms.testpicasso.js", "src/L.TimeDimension.layer.wms.picasso.js"
"src/L.TimeDimension.layer.wms.FCOO.js", "src/L.TimeDimension.layer.wms.picasso.js"
]
}
}
......
......@@ -26,7 +26,7 @@
<script src="../bower_components/leaflet-timedimension/dist/leaflet.timedimension.src.js"></script>
<script src="../bower_components/reqwest/reqwest.js"></script>
<script src="../bower_components/moment/moment.js"></script>
<script src="../src/L.TimeDimension.layer.wms.testpicasso.js"></script>
<script src="../src/L.TimeDimension.layer.wms.FCOO.js"></script>
<script src="../src/L.TimeDimension.layer.wms.picasso.js"></script>
<!-- endbower -->
......@@ -48,21 +48,40 @@
};
var wmsLayer = L.tileLayer.wms('http://wts.smhi.se/tile/', {
// SMHI
var smhiWMSLayer = L.tileLayer.wms('http://wts.smhi.se/tile/', {
layers: "NEMO:NS02_oceancurrentspeed_arrows_neurope_",
transparent: true,
crs: L.CRS.EPSG900913,
format: 'image/png',
attribution: 'Current forecasts from <a href="http://www.smhi.se" alt="Swedish Meteorological Hydrological Institute">SMHI</a>'
});
var weatherLayer = L.timeDimension.layer.wms.picasso(wmsLayer, {
var smhiWeatherLayer = L.timeDimension.layer.wms.picasso(smhiWMSLayer, {
proxy: 'proxy',
cache: 50
});
// FCOO
var fcooWMSLayer = L.tileLayer.wms('https://wms03.fcoo.dk/webmap/ECMWF/DXD/MAPS_ECMWF_DXD_DENMARK.nc.wms', {
layers: "windspeed",
transparent: true,
cmap: "Wind_ms_BGYRP_11colors",
crs: L.CRS.EPSG900913,
format: 'image/png',
attribution: 'Current forecasts from <a href="http://www.fcoo.dk">Marine Forecast Denmark</a>'
});
var fcooWeatherLayer = L.timeDimension.layer.wms.FCOO(fcooWMSLayer, {
proxy: 'proxy',
cache: 50
});
map.on('layeradd', function(layer, layername){
map.timeDimension.prepareNextTimes(1,10, false);
});
......@@ -71,7 +90,8 @@
var overlays = {
"Current arrows with speed": weatherLayer
"SMHI Current arrows with speed": smhiWeatherLayer,
"FCOO Current arrows with speed": fcooWeatherLayer
};
L.control.layers(baseLayers, overlays).addTo(map);
......
......@@ -76,8 +76,7 @@ L.TimeDimension.Layer.WMS.FCOO = L.TimeDimension.Layer.WMS.extend({
},
_getRefTimeFromCapabilities: function(xml) {
var layers = $(xml).find('Layer[queryable="0"]');
var layers = $(xml).find('Layer');
var layers = $(xml).find('Layer');
var layerName = this._baseLayer.wmsParams.layers;
var layerNameElement = layers.find("Name").filter(function(index) {
return $(this).text() === layerName;
......@@ -85,21 +84,15 @@ L.TimeDimension.Layer.WMS.FCOO = L.TimeDimension.Layer.WMS.extend({
var refTime ='';
if (layerNameElement) {
var layer = layerNameElement.parent();
var dimension = layer.find("Dimension[name='reftime']");
var dimension = layer.find("Dimension[name='time']");
if (dimension && dimension.length && dimension[0].textContent.length) {
refTime = dimension[0].textContent.trim();
} else {
var extent = layer.find("Extent[name='reftime']");
if (extent && extent.length && extent[0].textContent.length) {
refTime = extent[0].textContent.trim();
}
}
refTime = dimension[0].getAttribute('default');
}
}
return refTime;
},
_parseTimesFromCapabilities: function(xml) {
var layers = $(xml).find('Layer[queryable="0"]');
var layers = $(xml).find('Layer');
var layers = $(xml).find('Layer');
var layerName= this._baseLayer.wmsParams.layers;
var layerNameElement = layers.find("Name").filter(function(index) {
return $(this).text() === layerName;
......@@ -114,7 +107,6 @@ L.TimeDimension.Layer.WMS.FCOO = L.TimeDimension.Layer.WMS.extend({
}
}
console.log( times );
return times;
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment