2

I'm trying to add a NOAA hosted layer to an OpenLayers map. I've seen some examples of doing it with an older (pre 3) version of OpenLayers and of services no longer offered by NOAA. Has anyone tried to present any of the current NOAA services (such as the NEXRAD [ https://nowcoast.noaa.gov/arcgis/rest/services/nowcoast/radar_meteo_imagery_nexrad_time/MapServer/0 ] image) to a map with the current version of OpenLayers (5.2.0 in my case)?

Below is the code I was attempting to use, but it is definitely wrong as it ends up trying to retrieve the HTML instruction page instead of an image.

var source = new ol.source.ImageWMS({
    attributions: ['NOAA'],
    url: 'https://nowcoast.noaa.gov/arcgis/rest/services/nowcoast/radar_meteo_imagery_nexrad_time/MapServer/0',
    projection: 'EPSG:3857'
});

var layer = new ol.layer.Image({
    title: 'NOAA Radar',
    zIndex: 1,
    visible: true,
    source: source,
    opacity: 0.7
});

map.addLayer(layer);
1
  • url appears to be too long for a comment, will post as an answer
    – Mike
    Commented Sep 28, 2018 at 13:05

1 Answer 1

2
url: 'https://nowcoast.noaa.gov/arcgis/services/nowcoast/radar_meteo_imagery_nexrad_time/MapServer/WMSServer',
params: {'LAYERS': '1'},
2
  • Worked great, thanks! Out of curiosity, and so I can apply this for other services from that site, where did the "'LAYERS': '1'" params and the "WMSServer" extension on the URL come from? Looking at the original URL I don't see where this is documented. Commented Sep 28, 2018 at 16:04
  • A google search for "noaa radar wms" found the GetCapabilities link (the WMS url plus "?request=GetCapabilities&service=WMS"). That shows it has three layers with Name 1, 2, and 3.
    – Mike
    Commented Sep 28, 2018 at 16:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.