I am trying to create an OpenLayers.Layer.Image and incorporate it into my map. I have this block of code:

map = new OpenLayers.Map ({
            div: "dvMap",
            theme: null,
            projection: new OpenLayers.Projection ("EPSG:4326"),
            maxResolution: 360 / 512,
            center: new OpenLayers.LonLat (-80.92, 40.51),
            zoom: 6,
            layers: [
                 new OpenLayers.Layer.TMS ("TarigmaOSM",
                                           "http://" + maphost + "/cgi-bin/tilecache/tilecache.cgi/",
                                                serviceVersion: "1.0.0",
                                                layername: "osm",
                                                type: "png",
                                                attribution: "Data CC-by-SA OpenStreetMap"
                new OpenLayers.Layer.Image ("WeatherImage",
                                            "http://localhost:8080/data/get/weather/radar?stationID=2&productID=2&anticache=" + (new Date ()).getTime (),
                                            new OpenLayers.Bounds (-78.977468899814, 38.770277779319, -84.7329398692738, 41.9763540510698),
                                            new OpenLayers.Size (600, 550),


When I run this, I get my TarigmaOSM layer (base map) just fine, but I don't even see the request for the image layer file in Firebug, nor do I get any problems. Does anyone have any idea what's going on here and/or what I'm doing wrong?

1 Answer 1


Try supplying some options for the layer instead of nulling the default options out.

var options = {
    //numZoomLevels: 15,
    isBaseLayer: false,
    maxResolution: "auto",
    resolutions: map.layers[0].resolutions,
    projection: map.getProjectionObject(),
    strategies: [new OpenLayers.Strategy.Fixed()],
    displayInLayerSwitcher: true
new OpenLayers.Layer.Image("WeatherImage",
    "http://localhost:8080/data/get/weather/radar?stationID=2&productID=2&anticache=" + (new Date()).getTime(),
    new OpenLayers.Bounds(-78.977468899814, 38.770277779319, -84.7329398692738, 41.9763540510698),
    new OpenLayers.Size(600, 550),
  • While that sounded promising, it has had no effect.
    – Nik
    Mar 30, 2012 at 15:45
  • I added edited the options, please try again with resolutions: map.layers[0].resolutions,. These work for me. Everything else seems fine. You're sure http://localhost:8080/data/get/weather/radar?stationID=2&productID=2&anticache=blah returns an image? Also, FYI unlike WFS requests, you will not see any requests in Firebug for this Image overlay.
    – CaptDragon
    Mar 30, 2012 at 15:55
  • If you're still not seeing it, make sure it's not a very small spec west of Africa. If it is it's just a projection problem.
    – CaptDragon
    Mar 30, 2012 at 15:58
  • Are you seeing it in the layer switcher?
    – CaptDragon
    Mar 30, 2012 at 15:59
  • 1
    One thing I have found with Image layers is that Size can determine if they display or not. This appears to be related to whether you state the layer's maxResolution. CaptDragon had some good suggestions to troubleshoot. I'm thinking of perhaps spelling things out even more though it may not seem necessary. So, spell out maxResolution and projection. I don't spell out my image layer resolutions nor state displayInLayerSwitcher. However, I do set visibility: true in the options. And I don't think strategies is needed. Think that's primarily for vector layers. Mine haven't needed it. Apr 4, 2012 at 16:23

Your Answer

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

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