<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: Times New Roman; font-size: 12pt; color: #000000'><span>Hi,<br><br>I am trying to combine WMS-layers with the Openstreet Map as background.<br>The WMS-layers disapear as soon as I zoom in.<br>When working in geographic projection, I manage to get the WMS to show on a background layer.<br>I know it is possible as in the opengeo suite, it is possible to do it. Unfortunately, I cannot see how they did it.<br>I have added two simple examples with layers available on the net and the javascripts refering to the online sources.<br><br>Can somebody explain me what I do wrong?<br><br>A working simple example with the default projection:<br>====================================<br><html><br><head><br><br><title> A working GeoExt Map </title><br><script src="http://extjs.cachefly.net/ext-3.2.1/adapter/ext/ext-base.js" type="text/javascript"></script><br><script src="http://extjs.cachefly.net/ext-3.2.1/ext-all.js" type="text/javascript"></script><br><link rel="stylesheet" type="text/css" href="http://extjs.cachefly.net/ext-3.2.1/resources/css/ext-all.css"></link><br><script src="http://openlayers.org/api/OpenLayers.js" type="text/javascript"></script><br><script src="http://api.geoext.org/1.0/script/GeoExt.js" type="text/javascript"></script><br><link rel="stylesheet" type="text/css" href="http://api.geoext.org/1.0/resources/css/geoext-all-debug.css"></link><br><br><script type="text/javascript"><br> Ext.onReady(function() {<br> <br> var map = new OpenLayers.Map({allOverlays: true});<br> var kansas = new OpenLayers.LonLat(-99, 39);<br><br> var usa = new OpenLayers.Layer.WMS(<br> "usa", "http://demo.opengeo.org/geoserver/wms",<br> {<br> height: '330',<br> width: '680',<br> layers: 'nurc:Img_Sample',<br> styles: '',<br> srs: 'EPSG:4326',<br> format: 'image/png'<br> },<br> {singleTile: true, ratio: 1} <br> ); <br> var layer = new OpenLayers.Layer.WMS(<br> "USA pop",<br> "http://demo.opengeo.org/geoserver/wms",<br> {layers: "topp:states"},<br> {opacity: 0.5}<br> ); <br><br> map.addLayer(usa);<br> map.addLayer(layer);<br> <br> new GeoExt.MapPanel({<br> renderTo: 'gxmap',<br> height: 400,<br> width: 600,<br> map: map,<br> center: kansas,<br> zoom: 4,<br> title: 'A working GeoExt Map, default projection'<br> });<br> });<br></script><br></head><br><body><br><div id="gxmap"></div><br></body><br></html><br><br>============================================<br>the not working example with mercator projection<br>============================================<br><br><html><br><head><br><br><title> A WMS failing GeoExt Map </title><br><script src="http://extjs.cachefly.net/ext-3.2.1/adapter/ext/ext-base.js" type="text/javascript"></script><br><script src="http://extjs.cachefly.net/ext-3.2.1/ext-all.js" type="text/javascript"></script><br><link rel="stylesheet" type="text/css" href="http://extjs.cachefly.net/ext-3.2.1/resources/css/ext-all.css"></link><br><script src="http://openlayers.org/api/OpenLayers.js" type="text/javascript"></script><br><script src="http://api.geoext.org/1.0/script/GeoExt.js" type="text/javascript"></script><br><link rel="stylesheet" type="text/css" href="http://api.geoext.org/1.0/resources/css/geoext-all-debug.css"></link><br><br><script type="text/javascript"><br> Ext.onReady(function() {<br> <br> var geographic = new OpenLayers.Projection("EPSG:4326");<br> var mercator = new OpenLayers.Projection("EPSG:900913");<br><br> var map = new OpenLayers.Map({allOverlays: true,<br> projection: "EPSG:900913",<br> units: "m"<br> });<br> var kansas = new OpenLayers.LonLat(-99, 39).transform(geographic, mercator);<br><br> var osm = new OpenLayers.Layer.OSM(); <br> var layer = new OpenLayers.Layer.WMS(<br> "USA pop",<br> "http://demo.opengeo.org/geoserver/wms",<br> {layers: "topp:states"},<br> {opacity: 0.5}<br> ); <br><br> map.addLayer(osm);<br> map.addLayer(layer);<br> <br> new GeoExt.MapPanel({<br> renderTo: 'gxmap',<br> height: 400,<br> width: 600,<br> map: map,<br> center: kansas,<br> zoom: 4,<br> title: 'A WMS failing GeoExt Map, Mercator projection'<br> });<br> });<br></script><br></head><br><body><br><div id="gxmap"></div><br></body><br></html><br><br> <br><span name="x"></span>Erwin Sevens | OVAM<br>http://www.ovam.be<span name="x"></span><br></span><br></div></body></html>