I have a very known problem, but I can't solve it.
I have set the same maxExtents in the config as in the Openlayers init JS. I have done the same thing with the projection (EPSG:900913) and done all the transformation on OpenLayers FW. But there is still an error, that the tiles can't be shown because they don't start at the right point.
It seems that they are not constraint. Why? Any idea? Where is the keypoint in the solution!
Thanks. Martin
Edit:
I don't see any pics as tiles. I just see red-loadfail boxes. If I click with the right mouse button on the tile and let me show the picture I get this message: "An error occurred: Current x value 967644.673573 is too far from tile corner x 939258.202600"
My tilecache.cfg config is:
[osm]
type=MapnikLayer
mapfile= /var/www/tilecache/osm.xml
#layers=osm
spherical_mercator=true
#tms_type=google
srs=EPSG:900913
bbox=654558.60577333,5745163.8837113,1173307.4327978,6075303.6111284
#bbox=5.88,45.78,47.81,10.54
#maxReolution=19567.879237500
maxResolution=156543.03390000001
resolutions=156543.03390000001, 78271.516950000005, 39135.758475000002, 19567.879237500001, 9783.9396187500006, 4891.9698093750003, 2445.9849046875001, 1222.9924523437501, 611.49622617187504, 305.74811308593752, 152.87405654296876, 76.43702827148438, 38.21851413574219, 19.109257067871095, 9.5546285339355475, 4.7773142669677737, 2.3886571334838869, 1.1943285667419434, 0.59716428337097172, 0.29858214168548586
maxResolution=78271.51695
extent_type=loose
levels=20
OSM CODE
function init() {
var tilecacheBbox = new OpenLayers.Bounds(5.88, 45.78, 10.54, 47.81).transform(
new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984
new OpenLayers.Projection("EPSG:900913") // to Spherical Mercator Projection
);
alert(tilecacheBbox);
var map_options = {
maxExtent: tilecacheBbox,
restrictedExtent: tilecacheBbox,
maxResolution: 156543.03390000001,
resolutions: [156543.03390000001, 78271.516950000005, 39135.758475000002, 19567.879237500001, 9783.9396187500006, 4891.9698093750003, 2445.9849046875001, 1222.9924523437501, 611.49622617187504, 305.74811308593752, 152.87405654296876, 76.43702827148438, 38.21851413574219, 19.109257067871095, 9.5546285339355475, 4.7773142669677737, 2.3886571334838869, 1.1943285667419434, 0.59716428337097172, 0.29858214168548586],
//maxResolution: 78271.51695,
projection: new OpenLayers.Projection("EPSG:900913"),
//units: "meters",
numZoomLevels: 20
};
map = new OpenLayers.Map("basicMap", map_options);
map.addControl(new OpenLayers.Control.PanZoomBar());
map.addControl(new OpenLayers.Control.LayerSwitcher());
var mapnik = new OpenLayers.Layer.OSM();
// var tilescache = new OpenLayers.Layer.TileCache();
tiles = new OpenLayers.Layer.WMS("OSM@Mapnik", "tilecache/tilecache.cgi?",{
layers: 'osm', format: 'image/png', srs: 'EPSG:900913'
});
map.addLayer(mapnik);
map.addLayer(tiles);
map.setCenter(new OpenLayers.LonLat(8, 46.5) // Center of the map
.transform(
new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984
new OpenLayers.Projection("EPSG:900913") // to Spherical Mercator Projection
), 8 // Zoom level
);
}