Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DWD Rain Radar overlay #4

Open
dspreitz opened this issue Jan 28, 2019 · 2 comments
Open

Add DWD Rain Radar overlay #4

dspreitz opened this issue Jan 28, 2019 · 2 comments
Labels
enhancement New feature or request

Comments

@dspreitz
Copy link
Contributor

Under https://maps.dwd.de/geoserver/dwd/wms?service=WMS&version=1.1.0&request=GetMap&layers=dwd%3ARX-Produkt&bbox=-523.462%2C-4658.645%2C376.538%2C-3758.645&width=767&height=768&srs=EPSG%3A1000001&format=application/openlayers DWD offers Rain Radar data via openlayers.

I believe this is the relevant code snippet:

     var untiled = new ol.layer.Image({
       source: new ol.source.ImageWMS({
         ratio: 1,
         url: 'https://maps.dwd.de:443/geoserver/dwd/wms',
         params: {'FORMAT': format,
                  'VERSION': '1.1.1',  
               "LAYERS": 'dwd:RX-Produkt',
               "exceptions": 'application/vnd.ogc.se_inimage',
         }
       })
     });
     var tiled = new ol.layer.Tile({
       visible: false,
       source: new ol.source.TileWMS({
         url: 'https://maps.dwd.de:443/geoserver/dwd/wms',
         params: {'FORMAT': format, 
                  'VERSION': '1.1.1',
                  tiled: true,
               "LAYERS": 'dwd:RX-Produkt',
               "exceptions": 'application/vnd.ogc.se_inimage',
            tilesOrigin: -523.462 + "," + -4658.645
         }
       })
     });
     var projection = new ol.proj.Projection({
         code: 'EPSG:1000001',
         units: 'm',
         axisOrientation: 'neu',
         global: false
     });
     var map = new ol.Map({
       controls: ol.control.defaults({
         attribution: false
       }).extend([mousePositionControl]),
       target: 'map',
       layers: [
         untiled,
         tiled
       ],
       view: new ol.View({
          projection: projection
       })
     });
@Turbo87 Turbo87 added the enhancement New feature or request label Apr 26, 2019
@dspreitz
Copy link
Contributor Author

dspreitz commented Jul 27, 2019

Here is a short demo how to use the DWD rain radar data

<!doctype html>
<html lang="en">
  <head>
    <link rel="stylesheet" href="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.3.0/css/ol.css" type="text/css">
    <style>
      .map {
        height: 400px;
        width: 100%;
      }
    </style>
    <script src="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.3.0/build/ol.js"></script>
    <title>OpenLayers example</title>
  </head>
  <body>
    <h2>My Map</h2>
    <div id="map" class="map"></div>
    <script type="text/javascript">
    var tiled = new ol.layer.Tile({
       visible: false,
       source: new ol.source.TileWMS({
         url: 'https://maps.dwd.de:443/geoserver/dwd/wms',
         params: {'FORMAT': 'image/png', 
                  'VERSION': '1.1.1',
                  tiled: true,
               "LAYERS": 'dwd:RX-Produkt',
               "exceptions": 'application/vnd.ogc.se_inimage',
            tilesOrigin: -523.462 + "," + -4658.645
         }
       })
     });

      var untiled = new ol.layer.Image({
        source: new ol.source.ImageWMS({
          ratio: 1,
          url: 'https://maps.dwd.de:443/geoserver/dwd/wms',
          params: {'FORMAT': 'image/png',
                   'VERSION': '1.1.1',  
                "LAYERS": 'dwd:RX-Produkt',
                "exceptions": 'application/vnd.ogc.se_inimage',
          }
        })
      });


      var map = new ol.Map({
        target: 'map',
        layers: [
          new ol.layer.Tile({
            source: new ol.source.OSM(),
          }),tiled,untiled
        ],
        view: new ol.View({
          center: ol.proj.fromLonLat([11.41, 49.82]),
          zoom: 6
        })
      });
    </script>
  </body>
</html>

@dspreitz
Copy link
Contributor Author

This is the code, which needs to be added to app/service/map.js

//=========== DWD SAT Image Overlay
          new TileLayer({
             visible: true,
             source: new TileWMS({
             url: 'https://maps.dwd.de:443/geoserver/dwd/wms',
             params: {'FORMAT': 'image/png',
                   'VERSION': '1.1.1',
                    tiled: true,
                    "LAYERS": 'dwd:SAT_WELT_KOMPOSIT',
                    "exceptions": 'application/vnd.ogc.se_inimage',
                    tilesOrigin: -15.074981 + "," + 34.7373759815055
                    }
             }),
          }),
//=========== DWD Rain Radar Overlay
          new TileLayer({
             visible: true,
             source: new TileWMS({
             url: 'https://maps.dwd.de:443/geoserver/dwd/wms',
             params: {'FORMAT': 'image/png',
                   'VERSION': '1.1.1',
                    tiled: true,
                    "LAYERS": 'dwd:WX-Produkt',
                    "exceptions": 'application/vnd.ogc.se_inimage',
                    tilesOrigin: -15.074981 + "," + 34.7373759815055
                    }
             }),
          }),
//===========

However, there should be a button to turn each layer on and off.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants