[Tilecache] Re: tilecache problem with LABELMAXSCALEDENOM

Ivan Mincik ivan.mincik at gmail.com
Mon Jan 31 05:26:07 EST 2011


> how can I compute Tilecache resolutions with this value?

This is snippet from my python script which I am using to compute resolutions.

def get_resolutions(scales, units):
	"""Returns list of resolutions computed for given scales and units.
	
	:Parameters:
	  - `scales` (list of numbers) - list of scales in given units
	  - `units` (string) - one of: 'inches', 'ft', 'mi', 'm', 'km' or 'dd'
	
	:Returns:
		list of resolutions
	
	"""
	dpi = 72.0
	factor = {'inches': 1.0, 'ft': 12.0, 'mi': 63360.0, 'm': 39.3701,
'km': 39370.1, 'dd': 4374754.0}
	
	inches = 1 / dpi
	monitor_l = inches / factor[units]
	
	resolutions = []
	for scale in scales:
		real_l = monitor_l * int(scale)
		resolutions.append( '%.17f' % (real_l) )
	return resolutions


Ivan


More information about the Tilecache mailing list