I am trying to setup Mapnik + tilecache but can't see any tiles in the browser when I set bbox parameters in both Tilecache.cfg and Openlayers but when I don't specify the bbox everything works fine and I can see actual map tiles.
I was wondering if anyone can point out the problem in the code. I think I have tried everything ( in my limited capability) and not really understanding why would it not work. By the way all map layers ( for mapnik styling) are sourced from a PostGIS database and have different projections and transformed on the fly by Mapnik.
OpenLayers code:
var map, layer;
function init(){
var map, layer;
var options = {
numZoomLevels:20,
maxResolution: 360/512,
projection: "EPSG:4326",
maxExtent: new OpenLayers.Bounds(-2.0,50.0,2.0,54.0)
//not working when uncommented
};
map = new OpenLayers.Map( 'map', options);
layer = new OpenLayers.Layer.WMS( "Map24","tilecache.py?",
{
layers:'mapnik24',
format: 'image/png',
srs: 'EPSG:4326'
} );
map.addLayer(layer);
map.addControl( new OpenLayers.Control.PanZoomBar());
map.addControl( new OpenLayers.Control.MousePosition());
map.addControl( new OpenLayers.Control.LayerSwitcher());
map.addControl( new OpenLayers.Control.Permalink("permalink"));
if (!map.getCenter()) map.zoomToMaxExtent();
}
Tilecache.cfg:
[mapnik24]
type=Mapnik
mapfile=/somedit/map24.xml
bbox=-2.0,50.0,2.0,54.0
levels=20
srs=EPSG:4326
projection=+proj=latlong +datum=WGS84
-- Thanks, A
Looking at your code I think you are asking for the region bounded by 50 and 54 degrees east, and 2 degrees north and south. Is this correct?
If it is, then I think your bounds are the wrong way around. -2 degrees (south) should be at the bottom, and 2 degrees (north) should be at the top. So the bbox should be
2.0,50.0,-2.0,54.0
.Also, looking at that region in OpenStreetMap it looks like there's not much there, is that really what you intend?