def __init__(self): p = _pi # Transform from geography in radians to tile coordinates t = deriveTransformation(-p, p/2, 0, 0, p, p/2, 2, 0, -p, -p/2, 0, 1) LinearProjection.__init__(self, 0, t)
def __init__(self, srs, resolutions, tile_size=256, transformation=Transformation(1, 0, 0, 0, 1, 0)): """ Creates a new instance with the projection specified in srs, which is in Proj4 format. """ self.resolutions = resolutions self.tile_size = tile_size self.proj = Proj(srs) self.srs = srs self.tile_dimensions = \ [self.tile_size * r for r in self.resolutions] try: self.base_zoom = self.resolutions.index(1.0) except ValueError: raise TileStache.Core.KnownUnknown('No zoom level with resolution 1.0') LinearProjection.__init__(self, self.base_zoom, transformation)
def unproject(self, point, scale): p = LinearProjection.unproject(self, point) p.x = p.x / scale p.y = p.y / scale return p
def project(self, point, scale): p = LinearProjection.project(self, point) p.x = p.x * scale p.y = p.y * scale return p