[OpenLayers-Users] Untiled WMS on top of Google Maps doesn't alwaysshow up

Arnd Wippermann arnd.wippermann at web.de
Tue Aug 3 18:11:01 EDT 2010


Hi,

Set ratio:1, then the layer should displayed
{'opacity': 0.9, 'isBaseLayer': false, 'visibility': true, 'singleTile' :
true, ratio:1} 

Arnd

-----Ursprüngliche Nachricht-----
Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
Auftrag von Arjen de Korte
Gesendet: Dienstag, 3. August 2010 16:38
An: users at openlayers.org
Betreff: [OpenLayers-Users] Untiled WMS on top of Google Maps doesn't
alwaysshow up

Dear all,

I'm trying to show an untiled WMS layer on top of a Google Map in
OpenLayers, but under certain conditions (esp. zoomlevel 2) the overlay is
not displayed. I have this problem with our own WMS layers but also with the
"default" MetaCarta WMS layer, both in Firefox 3.6 and IE8, using Openlayers
2.9.1.

The code below (init function is called on page load) will load Google Maps
as the base layer and overlay it with the default MetaCarta WMS as an
untiled WMS layer. The WMS layer is set to display by default but it is not
shown in the browser in the default extent. When you zoom in it does show
up.

Note that this only applies to untiled WMS, for tiled WMS (singleTile =
false) it works fine. Also note that the WMS layer is actually loaded
correctly (as can be shown by e.g. Firebug), it just isn't displayed for
some reason.

I'd be grateful for any hints or suggestions to solve this problem!

Kind regards,

Arjen.



var map, layer;

function init(){

	var options = {
		projection: new OpenLayers.Projection("EPSG:900913"),
		displayProjection: new OpenLayers.Projection("EPSG:4326"),
		units: "m",
		numZoomLevels: 18,
		maxResolution: 156543.0339,
		maxExtent: new OpenLayers.Bounds(-20037508, -20037508,
20037508, 20037508.34)
	};

	map = new OpenLayers.Map('map', options);

	var gmap = new OpenLayers.Layer.Google(
		"Google Maps",
		{'sphericalMercator': true}
	);

	map.addLayer(gmap);

	var wmslayer = new OpenLayers.Layer.WMS("OpenLayers
WMS","http://labs.metacarta.com/wms/vmap0?",
		   {'layers': 'basic', 'format':'image/png',
'transparent':'true'},
		   {'opacity': 0.9, 'isBaseLayer': false, 'visibility':
true, 'singleTile' : true}
	);

	map.addLayer(wmslayer);

	map.addControl(new OpenLayers.Control.LayerSwitcher());
	map.addControl(new OpenLayers.Control.MousePosition());

	var point = new OpenLayers.LonLat(-20, 50);
	point.transform(new OpenLayers.Projection("EPSG:4326"),
map.getProjectionObject());
	map.setCenter(point, 2);
}
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users




More information about the Users mailing list