/usr/share/pyshared/TileCache/Services/MGMaps.py is in tilecache 2.11-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | # BSD Licensed, Copyright (c) 2006-2010 TileCache Contributors
from TileCache.Service import Request, Capabilities
import TileCache.Layer as Layer
class MGMaps (Request):
def parse (self, fields, path, host):
param = {}
for key in ['layer', 'zoom', 'x', 'y']:
if fields.has_key(key.upper()):
param[key] = fields[key.upper()]
elif fields.has_key(key):
param[key] = fields[key]
else:
param[key] = ""
return self.getMap(param)
def getMap (self, param):
layer = self.getLayer(param["layer"])
level = int(param["zoom"])
level = 17 - level
x = float(param["x"])
y = float(param["y"])
res = layer.resolutions[level]
maxY = int(
round(
(layer.bbox[3] - layer.bbox[1]) /
(res * layer.size[1])
)
) - 1
tile = Layer.Tile(layer, x, maxY - y, level)
return tile
|