[Tilecache] Problem with resolution
Eric Lemoine
Eric.Lemoine at camptocamp.com
Wed Feb 28 02:37:25 EST 2007
On 2/27/07, Yves Jacolin <yjacolin at free.fr> wrote:
> Hi,
>
> I am using OL with a WMS serveur (same layer than the vmap0 WMS from
> metacarta). All this is hosted by a quiet good server. But the 'tiles' take
> some time to be displayed. So I am now trying to use TileCache to improve this
> but I have some problem to set it up. I modified OL as is:
>
> var options = {maxResolution: 0.04578125,
> maxZoomLevel: 13,
> minZoomLevel: 5,
> numZoomLevels : 7,
> controls:[]};
> map = new OpenLayers.Map('map', options);
>
> And my tilecache.cfg:
>
> [vmap]
> type=MapServerLayer
> layers=regions
> mapfile=/var/local/name/project/vmap.map
> resolutions=0.1,0.04578125,0.00071533203125
> levels=7
> extension=gif
>
> If I go to the maxZoom level or the minZoom level, all is ok, I can see the
> map, if I change the zoom between this two level, the map doesn't appear.
>
> Any idea? How can I find all the resolution values?
Hi Yves,
You can define the scales in your map options, using something like this:
var myScales = [ 3750, 7500, 15000, 30000, 60000, 120000 ];
var options = { scales: myScales, ... };
map = new OpenLayers.Map($('map'), options);
And to get the corresponding resolution values use the
OpenLayers.Util.getResolutionFromScale() method. E.g.
var str = "";
for (var i = 0; i < myScales.length; i++) {
str += OpenLayers.Util.getResolutionFromScale(myScales[i], 'm') + ',';
}
Hope this helps,
--
Eric
More information about the Tilecache
mailing list