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

Paul Spencer pagameba at gmail.com
Sun Nov 4 09:51:02 EST 2007


Steve,

I got it to work with a bit of frigging around:

tilecache.cfg

[navteq-sample]
type=MapServerLayer
mapfile=/var/data/navteq-2007.2/map/navteq-2007.2.map
layers=navteq-2007.2
metaTile=yes
extent_type=loose
bbox=-122.6579,37.4901,-122.0738,37.8795
resolutions=0.000634956337608418,0.000396847711005261,0.0002381086266031 
57,0.000111117359081473,0.0000555586795407366,0.0000380973802565051,0.00 
00238108626603157,0.00000793695422010523

For layers= I put the name of the map file.  Note that internally the  
code uses the wxs scripting interface so I am not sure if that  
affects the logic of what layers get turned on/off or not.

OpenLayers code:

var map = new OpenLayers.Map(
     $('map'),
     {controls:[],
      maxExtent:new OpenLayers.Bounds 
(-122.6579,37.4901,-122.0738,37.8795),
      maxResolution:0.000634956337608418,
      resolutions:[0.000634956337608418,
                   0.000396847711005261,
                   0.000238108626603157,
                   0.000111117359081473,
                   0.0000555586795407366,
                   0.0000380973802565051,
                   0.0000238108626603157,
                   0.00000793695422010523]
     }
    );

tcLayer = new OpenLayers.Layer.TileCache("TileCache Layer",
             ["http://web01.dmsolutions.ca/cache/",
              "http://web02.dmsolutions.ca/cache/",
              "http://web03.dmsolutions.ca/cache/",
              "http://web04.dmsolutions.ca/cache/"],
             "navteq-sample");

map.addLayer(tcLayer);


I believe the important part is to get the bounding box the same and  
at least the maxResolution, although in my case I had a specific list  
of resolutions to support because they are not a linear progression.

Cheers

Paul


On 2-Nov-07, at 5:37 PM, 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

+-----------------------------------------------------------------+
|Paul Spencer                          pspencer at dmsolutions.ca    |
+-----------------------------------------------------------------+
|Chief Technology Officer                                         |
|DM Solutions Group Inc                http://www.dmsolutions.ca/ |
+-----------------------------------------------------------------+





More information about the Tilecache mailing list