[OpenLayers-Users] WMS over Google Maps when panning tiles not in
synch
Alessandro Ferrucci
alessandroferrucci at gmail.com
Sun Jul 24 15:50:33 EDT 2011
Hello,
I have the following code
var map;
var projectionWGS84 = new OpenLayers.Projection("EPSG:4326");
var projectionMercator = new OpenLayers.Projection("EPSG:900913");
// Avoid pink error tiles
OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3;
OpenLayers.Util.onImageLoadErrorColor = "transparent";
function init(){
var options = {
projection: new OpenLayers.Projection("EPSG:900913"),
displayProjection: new OpenLayers.Projection("EPSG:4326"),
units: "m",
maxResolution: 156543.0339,
maxExtent: new OpenLayers.Bounds(-20037508,
-20037508,20037508, 20037508),
restrictedExtent: new
OpenLayers.Bounds(-164.88281,5.09094,-41.39648,52.69636).transform(projectionWGS84,projectionMercator),
controls:[
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.ArgParser(),
new OpenLayers.Control.Attribution(),
new OpenLayers.Control.PanZoomBar({ position:
new OpenLayers.Pixel(2, 15) }),
new OpenLayers.Control.Scale($('scale')),
new OpenLayers.Control.LayerSwitcher(),
new OpenLayers.Control.MousePosition(),
new OpenLayers.Control.Permalink()
]
};
map = new OpenLayers.Map('map',options);
var googleHibridLayer = new OpenLayers.Layer.Google(
"Google Hibrid", {type: google.maps.MapTypeId.HYBRID,
'sphericalMercator': true,isBaseLayer: true } );
var googleStreetLayer = new OpenLayers.Layer.Google(
"Google Street", {'sphericalMercator':true} );
var addressLayer = new OpenLayers.Layer.WMS(
"Addresses", "<WMS SERVER HOSTNAME>",
{
LAYERS: 'cira:address',
STYLES: '',
format: 'image/png',
tiled: true,
transparent:true,
tilesOrigin : map.maxExtent.left + ',' +
map.maxExtent.bottom
},
{
buffer: 10,
displayOutsideMaxExtent: true,
isBaseLayer: false
}
);
map.addLayers([googleStreetLayer,googleHibridLayer,addressLayer]);
var USABounds=new
OpenLayers.Bounds(-124.731,24.956,-66.97,49.372);
USABounds.transform(projectionWGS84,map.getProjectionObject());
map.zoomToExtent(USABounds);
}
The WMS looks to be overlaying fine, but when I pan the map the tiles
look like they are "shifting plates" meaning they look like they are
moving independently and it looks quite ugly.
I have tried adding "projection: new
OpenLayers.Projection("EPSG:900913")," as an option to the WMS layer
itself thinking maybe that would fix it but it did not.
I'm using stable Openlayers 2.10
Any ideas?
Thank you,
--
Signed,
Alessandro Ferrucci
More information about the Users
mailing list