Summary:
I have 2 different image layers that looked fine with my old mapstraction/google maps based system. Using the same coordinates as bounds in openlayers results in a shift to the north by like 100 miles.
- potentially most important is that this seems to be limited to the image layers only. For all of the vector-based layers I've looked at (vector based markers and vector based polylines), they all seem to be in the right spot when compared to the old system.
- one image layer is an image of text where the original coordinates were chosen somewhat arbitrarily so the fact that it's shifted north is not a big deal (screenshot example: https://img.skitch.com/20110427-jj62ac75y8eihms3gxxfr15371.jpg)
- the other image layer is weather radar and it's absolutely essential that the image overlay be in the correct place (screenshot example: http://img.skitch.com/20110426-dxwtj44q4g9su5e58p9gc85x2s.jpg)
- this happens with Google Maps v3 base layers and OpenStreetMap base layers. I have not tested other base layers
- the original question below was centered around the weather radar problem because that's where I originally noticed the image overlay problem, but it would appear that whatever I'm doing wrong for the weather radar image layer is also being done wrong for the text/image overlay.
I'm new to OpenLayers, so I'm hoping I'm missing something obvious.
I'm trying to transition my maps to OpenLayers from Mapstraction (and before that it was just the plain Google Maps v3 API). I'm having issues with one of the images not aligning properly (though all other types of layers seem to work just fine).
Specifically, I'm trying to overlay a weather radar image (http://radar.weather.gov/ridge/Conus/RadarImg/latest_radaronly.gif) but it's not putting it in the correct place. I've tried using both OSM and Google Maps v3 base layers, and it always appears to be too far north.
Screenshot explanation: img.skitch.com/20110426-dxwtj44q4g9su5e58p9gc85x2s.jpg
I originally got the coordinates through the KMZ file that you can download here: www.srh.noaa.gov/ridge/kmzgenerator.php. Click on "Lower 48 States" under the "National & regional mosaics" section to get the KMZ file. Alternatively, the KML contents are viewable here: gist.github.com/942730
I'm assuming I'm not specifying the bounds for the image layer properly:
# full code in the example links below this
proj4326 = new OpenLayers.Projection("EPSG:4326");
bounds = new OpenLayers.Bounds();
bounds.extend(new OpenLayers.LonLat(-127.620375523875420, 21.652538062803));
bounds.extend(new OpenLayers.LonLat(-66.517937876818, 50.406626367301044));
bounds.transform(proj4326, mapObject.getProjectionObject());
radar_overlay = new OpenLayers.Layer.Image('radar', 'http://radar.weather.gov/ridge/Conus/RadarImg/latest_radaronly.gif', bounds, new OpenLayers.Size(3400, 1600), {
'isBaseLayer': false,
'alwaysInRange': true
});
Full Examples:
http://jsfiddle.net/hayley/C4rue/ - (out of place) - simplified example with OL and google maps v3
beta.wickedwx.com/ - (out of place) more complete example - on this map, there's also an orange dot for the radar location at Wichita, Kansas where there's usually a blue blob (ground clutter on the radar), but the blue blob ends up being placed near Salina, Kansas (screenshot example: img.skitch.com/20110426-dxwtj44q4g9su5e58p9gc85x2s.jpg)
http://wickedwx.com/ - working example that uses mapstraction and google maps v3