I have a Geoserver with a layer in a EPSG:32632 projection. I want to display this layer over Open Street Map tiles.
When I use the following html code:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://www.openlayers.org/api/2.11/OpenLayers.js"></script>
<script>
var map, layer;
function init(){
var epsg900913 = new OpenLayers.Projection("EPSG:900913");
var epsg4326 = new OpenLayers.Projection("EPSG:4326");
var cent=new OpenLayers.LonLat(6.59,46.39).transform(epsg4326,epsg900913);
var osm = new OpenLayers.Layer.OSM("Open Street Map");
bwms = new OpenLayers.Layer.WMS("Trajectory", "http://server.domain.com:8080/geoserver/test/wms",
{
version: "1.3.0",
layers: "test:v_trajectory",
transparent: true,
tiled: true
},
{
visibility: true,
sphericalMercator: true,
displayOutsideMaxExtent: true // Will not appear with certain zooms without this option
}
);
map = new OpenLayers.Map("map",{
layers:[osm,bwms],
center: cent,
zoom: 10
});
// map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
map.addControl( new OpenLayers.Control.LayerSwitcher() );
}
</script>
</head>
<body onload="init()">
<div style="width:500px; height:500px" id="map"></div>
</body>
</html>
The OSM tiles are correctly displayed but the other layer does not appear on the map. I guess it is a projection problem, since the OSM tiles are in EPSG:900913, but isn't Geoserver supposed to feed me a reprojected map directly? With Firebug, I can see that the request has correctly been treated, but return blank 256x256 tiles. The request is also made for a SRC EPSG:900913, so the problem must be server-side.
What am I missing? The layer is feeded to Geoserver via PostGIS (in the OpenGeo framework). Am I supposed to put some specific settings client-side?
As a consistency check, I also used the Geoserver "preview layer" tool with OpenLayers, to see if the layer is correctly dispayed, and it is. However, if I declare a SRS 900913 in addition to the native 32632, I also get blank tiles in the tool. So I guess the answer is probably related to Geoserver and not OpenLayers. I really don't understand what I'm missing... Any help would be most welcome!
geowebcache-cache-result: MISS
, while the preview tool has nothing of the sort.