[OpenLayers-Users] How to calculate maxResolution

Tue Topholm tt at sugee.dk
Tue Aug 16 17:57:23 EDT 2011


Hi All

I have been banging my head against this a few times, but I finally
found a method to do it, but know I have a question...

I'm using tilecache to generate some tiles, here is my conf:

[test]
type=WMS
url=xxxxx
extension=png
srs=EPSG:25832
bbox=713227,6179823,722265,6186635
layers=test_layer

I seeds fine, but when I but into openlayers it off a bit, the
wms/tilecache is shifted...

Here is my openlayers conf...

var options = {
	projection: new OpenLayers.Projection("EPSG:25832"),
	displayProjection: new OpenLayers.Projection("EPSG:25832"),
	maxResolution: 'auto',
	units: 'm',
	maxExtent: new OpenLayers.Bounds(713227,6179823,722265,6186635)};


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


layer = new OpenLayers.Layer.TileCache( "TMS",'testurl',
'test_layer',{isBaseLayer:true});



	map.addLayer(layer);

layer = new OpenLayers.Layer.WMS( "test wms",'http://xxxxxx',
{layers:'test',format:'image/png'},{isBaseLayer:false,
singleTile:true, ratio:2});
			map.addLayer(layer);


html:
<div style="height:800px;width:800px;" id="topMap"></div>

But then I found this page:

http://code.google.com/p/xenia/wiki/TileCache

where it said i should take left - right / div width

so: (713227 - 722265)*-1 / 800 = 11.2975

So my maxresolution is 11.2975.

Then I seeded my tilecache again with and it works fine....

But what if I need to change my div sizes, do I need to reseed all my cache?

--

Med venlig hilsen / Kind regards

Tue Topholm
Sugee
Tlf: +45 32 13 32 32
W: http://www.sugee.dk


More information about the Users mailing list