EN · DE · FR · IT · ES
  • Products
  • Pricing
  • Documentation
  • Log in Try for free

Overlay roads and labels on aerial imagery using WMS

Request two WMS images in EPSG:25832 to display OpenStreetMap roads and labels over aerial imagery of Düsseldorf.

Back to web application examples

Map

What it does

The map opens at zoom level 15 over the Rhine in Düsseldorf. OpenLayers draws roads and labels over a color aerial photograph.

How it works

OpenLayers requests the nw_dop_rgb layer as a JPEG from the Geobasis NRW aerial WMS. Our WMS returns a transparent PNG for the same extent. Both requests use ETRS89 / UTM zone 32N (EPSG:25832).

In the overlay source, set LAYERS to 'roads,labels' to request both layers, or to 'labels' for labels alone.

On high-density screens, OpenLayers requests up to twice as many pixels in each dimension for both images. With serverType: 'qgis', OpenLayers sends the matching DPI value to our WMS. Our WMS uses that value when hq=true to keep text size and line widths consistent on screen.

Code

Replace your-api-key with your public raster API key. Save the code as an HTML file and serve it from the domain registered for that key.

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <script src="https://cdn.jsdelivr.net/npm/proj4@2.15.0/dist/proj4.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/ol@v10.3.1/dist/ol.js"></script>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ol@v10.3.1/ol.css">
      
    <script>
      function initMap() {
        const projection = 'EPSG:25832';
        const pixelRatio = Math.min(2, Math.max(1, window.devicePixelRatio || 1));
        proj4.defs(projection, '+proj=utm +zone=32 +ellps=GRS80 +units=m +no_defs');
        ol.proj.proj4.register(proj4);

        const imagery = new ol.layer.Image({
            source: new ol.source.ImageWMS({
                url: 'https://www.wms.nrw.de/geobasis/wms_nw_dop',
                params: {VERSION: '1.1.1', LAYERS: 'nw_dop_rgb', FORMAT: 'image/jpeg'},
                serverType: 'mapserver',
                projection,
                ratio: 1,
                attributions: '<a href="https://www.bezreg-koeln.nrw.de/geobasis-nrw">Geobasis NRW</a>',
            }),
        });
        const overlay = new ol.layer.Image({
            source: new ol.source.ImageWMS({
                url: 'https://maps.omniscale.net/v2/your-api-key/style.default/attribution.false/map',
                params: {
                    VERSION: '1.1.1',
                    LAYERS: 'roads,labels',
                    FORMAT: 'image/png',
                    TRANSPARENT: true,
                    hq: pixelRatio > 1,
                },
                serverType: 'qgis', // Send the WMS DPI parameter.
                projection,
                ratio: 1,
                attributions: '© 2026 <a href="https://maps.omniscale.com/">Omniscale</a> · ' +
                        "Map data:" + ' <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> (ODbL)',
            }),
        });
        new ol.Map({
            target: 'map',
            pixelRatio,
            controls: ol.control.defaults.defaults({attributionOptions: {collapsible: false}}),
            layers: [imagery, overlay],
            view: new ol.View({
                projection,
                center: [344514, 5677725],
                extent: ol.proj.transformExtent([6.4, 50.85, 7.68, 51.54], 'EPSG:4326', projection),
                zoom: 15,
                minZoom: 12,
                maxZoom: 20,
                enableRotation: false,
            }),
        });
      }
    </script>

  </head>
  <body onload='initMap()'>
    <div id='map' style='height: 400px; max-width: 1150px; margin-inline: auto;'></div>
  </body>
</html>

Documentation

  • Omniscale raster API documentation
  • OpenLayers documentation

Help and Service

  • Register • Log in
  • Products & Functions
  • Plans and Pricing
  • Interactive map
  • Help, Documentation & API
  • Available projections

About us

  • Legal
  • Terms and Conditions
  • Privacy

Contact details

Omniscale GmbH & Co. KG
Moltkestraße 6a
26122 Oldenburg
Germany
Go to contact form ↝

Copyright © 2026 • Omniscale, Map data: OpenStreetMap (License: ODbL)

* For business customers only. We do not enter into contracts with consumers within the meaning of Section 13 of the German Civil Code (BGB). All prices are listed excluding VAT.