[Tilecache] Extents vs. resoultion vs. maxResolution HowTo?

Josh Livni josh at umbrellaconsulting.com
Fri Nov 2 18:15:32 EDT 2007


Steve,

As you note, I think the key is to have the same resolutions array in 
both the OL map definition, and the tilecache config.  I usually just 
set maxresolution on both of these, rather than define an entire array 
of resolutions.  I usually define my maxresolution by taking the width 
my bounding box, and dividing by 512.  Not sure if this is the 'correct' 
way to go, but it seems to work fine for me. 

So with your example, I would probably try:
 - uncomment the bbox line in your tilecache config
 - add "maxResolution=2687.173028" to your tilecache config
 - add a "maxResolution:2687.173028," parameter to your OL map, eg:
----

map = new OpenLayers.Map( $('map'), {maxResolution: 2687.173028, units: "m", maxExtent: new OpenLayers.Bounds(59874.874702,4793122.838717,853624.446078,5481039.133908)} );

----

[compass]
    metaTile=true
    type=MapServerLayer
    layers=
    mapfile=/usr/local/www/docs_maps/compass/compass.map
    srs=EPSG:29615
    #extent_type=loose
    bbox=59874.874702,4793122.838717,853624.446078,5481039.133908
    maxResolution=2687.173028


As a total aside, I've not used the MapServerLayer before, and have no 
idea what happens when you leave the layers parameter blank in the 
tilecache config.

Hope this helps more than confuses,

  -Josh

Steve Lime wrote:
> I'm sick of beating my head against the wall so am just going to ask. Is there documentation
> that details the joint setup of OpenLayers against TileCache with detail on the computations
> necessary to get things sync'd up correctly? I'm trying to setup a cache for a simple no layer
> (e.g. everything is STATUS DEFAULT) MapServerLayer.
>
> In the tilecache config I have (at this point):
>
>     [compass]
>     metaTile=true
>     type=MapServerLayer
>     layers=
>     mapfile=/usr/local/www/docs_maps/compass/compass.map
>     srs=EPSG:29615
>     extent_type=loose
>     #bbox=59874.874702,4793122.838717,853624.446078,5481039.133908
>
> and the sample client:
>
>     <script type="text/javascript">
>         <!--
>         var map, layer;
>
>         function init(){
>             map = new OpenLayers.Map( $('map'), {maxExtent: new OpenLayers.Bounds(59874.874702,4793122.838717,853624.446078,5481039.133908)} );
>             layer = new OpenLayers.Layer.WMS( "test", "tilecache.cgi?", {layers: 'compass', format: 'image/png', projection:'EPSG:26915'} );
>             map.addLayer(layer);            
>             if (!map.getCenter()) map.zoomToMaxExtent();
>         }
>         // -->
>     </script>
>
> I've tried a number of combinations of maxResolution, maxExent, resolutions and so on with 
> no luck. This configuration results in tile errors like this initially:
>
> An error occurred: can't find resolution index for 1.406250. Available resolutions are: 
> [0.703125, 0.3515625, 0.17578125, 0.087890625, 0.0439453125, 0.02197265625, 0.010986328125, 0.0054931640625, 0.00274658203125, 0.001373291015625, 0.0006866455078125, 0.00034332275390625, 0.000171661376953125, 8.58306884765625e-05, 4.291534423828125e-05, 2.1457672119140625e-05, 1.0728836059570312e-05, 5.3644180297851562e-06, 2.6822090148925781e-06, 1.3411045074462891e-06]
>
> and this if one zooms in once:
>
> An error occurred: Current x value 456594.874702 is too far from tile corner x 456660.000000
>
> I must be missing something obvious (am used to ka-map and using scale values instead of 
> resolutions). There must be a standard setup for MapServerLayer and non-geographics 
> coordinates.
>
> Thanks- Steve
>
> _______________________________________________
> Tilecache mailing list
> Tilecache at openlayers.org
> http://openlayers.org/mailman/listinfo/tilecache
>   



More information about the Tilecache mailing list