[OpenLayers-Users] image layers shifted north on gmaps v3 and OSM base layers

hayley openlayers at vortex.cx
Fri Apr 29 10:31:42 EDT 2011


I've posted the longer story over on the GIS StackExchange here:
http://gis.stackexchange.com/q/8981/2780

So I'll just try to sum up here:
I'm trying to transition from a Mapstraction/Google Maps based system to
using OpenLayers with Google Maps v3 base layers (though I'm also having the
same problem using OSM as a base layer).

As far as I can tell, it's only the image layers that are giving me
problems; the vector based layers seem to line up correctly when compared to
the old system.

I have 2 image layers where I'm setting the same bounds as I was using on
the old system, but both of them appear to be shifted north.

Example #1: text image
http://img.skitch.com/20110427-jj62ac75y8eihms3gxxfr15371.jpg

Example #2: weather radar
http://img.skitch.com/20110426-dxwtj44q4g9su5e58p9gc85x2s.jpg

I only really care about the weather radar lining up, but whatever I've done
wrong, I've done wrong on both apparently.

proj4326 = new OpenLayers.Projection("EPSG:4326");

# TEXT IMAGE OVERLAY

bounds = new OpenLayers.Bounds();
    bounds.extend(new OpenLayers.LonLat(-115, 30));
    bounds.extend(new OpenLayers.LonLat(-80, 50));
    bounds.transform(proj4326, mapObject.getProjectionObject());
    no_thunderstorms = new OpenLayers.Layer.Image('no thunderstorms
text', '/no_thunderstorms.png', bounds, new OpenLayers.Size(450, 200),
{
      'isBaseLayer': false,
      'alwaysinrange': true,
      'visibility': false
    });

# WEATHER RADAR OVERLAY

# (I also was previously using OpenLayers.LonLat instead of
OpenLayers.Geometry.Point to see if it made a difference and it
didn't)

bounds = new OpenLayers.Bounds();
    bounds.extend(new OpenLayers.Geometry.Point(-127.620375523875420,
21.652538062803));
    bounds.extend(new OpenLayers.Geometry.Point(-66.517937876818,
50.406626367301044));
    bounds.transform(proj4326, mapObject.getProjectionObject());
    window.bounds = bounds;
    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
    });

Live example of the weather radar being shifted north:
http://jsfiddle.net/hayley/C4rue/ (compare to radar overlay on
http://wickedwx.com ).

So far, the related issues/solutions I've seen seem to be centered around
setting options that appear to not be applicable to gmaps v3 since
"projection, maxExtent, units or maxResolution" are not required per
http://openlayers.org/blog/2010/07/10/google-maps-v3-for-openlayers/ though
correct me if I'm wrong there.

Any help would be greatly appreciated!

Hayley
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110429/39d458bc/attachment.html


More information about the Users mailing list