OL3 and CAMS

This post demonstrates integrating the ECMWF public CAMS WMS products with Open Layers 3.

This was as an answer to this Stack Overflow question.

The map below shows the AOD 550 data layer, which is the total aerosol optical depth at 550 nm, a measure of the total amount of particles in the atmosphere (dust, smoke, pollution, sea salt) which block sunlight by absorbing or by scattering light. It is overlaid on an Open Street Map.

Example

Script

var map = new ol.Map({
    layers: [
        new ol.layer.Tile({
            source: new ol.source.OSM()
        }),
        new ol.layer.Tile({
            preload: Infinity,
            visible: true,
            source: new ol.source.TileWMS({
                url: 'http://apps.ecmwf.int/wms/',
                params: {'LAYERS': 'composition_aod550', 'token':'public'},
                serverType: 'geoserver',
                crossOrigin: 'anonymous',
                projection: 'EPSG:4326',
            }),
            opacity: 0.4,
        })
    ],
    target: 'map',
    view: new ol.View({
        center: [0, 0],
        zoom: 2
    })
});