[GIS] Cannot Overlay PNG onto Map with OpenLayers

javascriptopenlayers-2

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?

Best Answer

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),
    options)
...