[OpenLayers-Users] WMS overlay not shown at zoom level 0 when singleTile: true

Tom B seileef at gmail.com
Wed Feb 3 13:41:51 EST 2010


Hi all,

In the attached code, the WMS overlay is shown fine at zoom level 1, but at
zoom level 0, it disappears.  If I either remove the "singleTile: true"
option, or use a MetaCarta base layer instead of the Google one, then the
overlay shows up fine at zoom level 0.

I took a look at the WMS request at map.layers[1].grid[0][0].url at zoom
level 0, and GeoServer renders that URL fine, so it looks like this issue is
related to OpenLayers.

Any ideas of what might be going wrong here?

Best,
Tom

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
	<script type="text/javascript"
src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=false
	
&amp;key=ABQIAAAAmlH3GDvD6dTOdZjfrfvLFxTkTKGJ2QQt6wuPk9SnktO8U_sCzxTyz_WwKoSJx63MPLV9q8gn8KCNtg">
	</script>
    <script src="http://www.openlayers.org/api/OpenLayers.js"></script>
    <script type="text/javascript">
        var lon = 5;
        var lat = 40;
        var zoom = 1;
        var map, layer;

        function init(){
        
        	var mapOptions = {
				controls: [],
				projection: new OpenLayers.Projection("EPSG:900913"),
				units: "m",
				maxResolution: 156543.0339,
				maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34,
20037508.34, 20037508.34),
				restrictedExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34,
20037508.34, 20037508.34),
				minZoomLevel: 2
			};
			
            map = new OpenLayers.Map('map', mapOptions);

			map.addControl(new OpenLayers.Control.PanZoomBar());
			
			if(true){
				var base_layer = new OpenLayers.Layer.Google(
					"Google Satellite",
					{
						type: G_SATELLITE_MAP,
						sphericalMercator: true,
						isBaseLayer: true
					}
				);
			}else{			
				var base_layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
					"http://labs.metacarta.com/wms/vmap0",
					{
						layers: 'basic',
						sphericalMercator: true,
						isBaseLayer: true
					}
				);
			}	
			map.addLayer(base_layer);
			map.setBaseLayer(base_layer);
			

            map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
            map.addControl( new OpenLayers.Control.LayerSwitcher() );
            
			var new_layer = new OpenLayers.Layer.WMS('asdf',
"http://sds7.itc.virginia.edu:8080/thdl-geoserver/wms",
				{
					layers: 'thl:roman_popular_poly',
					transparent: true,
					sphericalMercator: true,
					projection: new OpenLayers.Projection("EPSG:900913"),
					units: "m",
					CQL_FILTER: "fid=1"
				},
				{
					singleTile: true
				}
			);
			map.addLayer(new_layer);
				
            
        }
    </script>
  </head>
  <body onload="init()">
  
    <div id="map" class="smallmap"></div>
    
  </body>
</html>
-- 
View this message in context: http://n2.nabble.com/WMS-overlay-not-shown-at-zoom-level-0-when-singleTile-true-tp4508945p4508945.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list