[GIS] tile cache error : Lower left corner is outside layer bounds

openlayers-2tilecachetiles

i have made a wms layers in openlayers consuming cached tiles generatred by tile cache , in the generation step i have used this configuration :

[vmap0]
type=WMS
url=http://localhost/cgi-bin/mapserv?map=maps/poimanager/nav 2tiles.map
layers=nav_map
bbox=-855822.40976158,3975513.7271299,-847686.6435646,3976531.2950689
levels=20

concerning the map in openlayers i have defined the resolutions in map instance options:

      var options = {
    maxExtent: new OpenLayers.Bounds(-2015494, 2445884, 48919, 4383204),
    projection: "EPSG:900913",
    displayProjection: new OpenLayers.Projection("EPSG:4326"),
    units: 'm',
    numZoomLevels: 20,
resolutions :[3.9725420883691527, 1.9862710441845763, 0.99313552209228817, 0.49656776104614408, 0.24828388052307204, 0.12414194026153602, 0.062070970130768011, 0.031035485065384005, 0.015517742532692003, 0.0077588712663460013, 0.0038794356331730007, 0.0019397178165865003, 0.00096985890829325017, 0.00048492945414662508, 0.00024246472707331254, 0.00012123236353665627, 6.0616181768328135e-05, 3.0308090884164068e-05, 1.5154045442082034e-05, 7.5770227210410169e-06]
            };

            var map = new OpenLayers.Map('map', options);

but i still get nothing just when i try to view the images using firebug it gimme this error :

"An error occurred: Lower left corner (-851825.191138, 3976933.501194) is outside layer bounds [-855822.40976158006, 3975513.7271298999, -847686.64356460003, 3976531.2950689001].
To remove this condition, set extent_type=loose in your configuration."

can you help me resolve this error 🙂

thanks in advance 🙂

Best Answer

Did you try what the error message suggested and set the extent_type to loose?

[vmap0]
type=WMS
url=http://localhost/cgi-bin/mapserv?map=maps/poimanager/nav 2tiles.map
layers=nav_map
bbox=-855822.40976158,3975513.7271299,-847686.6435646,3976531.2950689
levels=20
extent_type=loose

I've also had to update one of the Python files in TileCache to avoid the "too far from tile corner" errors on a couple of occasions using the patch outlined here.

If neither of these work then there is a problem with your bbox and the resolutions you have in OpenLayers. I'd set the maxExtent in OpenLayers to the extent of the world in EPSG:900913 and remove your resolutions parameter from your OpenLayers layer setup.