def __init__(self, style, tile_format="png"): # the spherical mercator world tile covers (-π, -π) to (π, π) t = deriveTransformation(-pi, pi, 0, 0, pi, pi, 1, 0, -pi, -pi, 0, 1) self.projection = MercatorProjection(0, t) self.style = style self.tile_format = tile_format
def __init__(self, style, tile_format='png'): # the spherical mercator world tile covers (-π, -π) to (π, π) t = deriveTransformation(-pi, pi, 0, 0, pi, pi, 1, 0, -pi, -pi, 0, 1) self.projection = MercatorProjection(0, t) self.style = style self.tile_format = tile_format
def __init__(self, apikey, style=None): # the spherical mercator world tile covers (-π, -π) to (π, π) t = deriveTransformation(-pi, pi, 0, 0, pi, pi, 1, 0, -pi, -pi, 0, 1) self.projection = MercatorProjection(0, t) self.key = apikey if style: self.style = style
def __init__(self, template): # the spherical mercator world tile covers (-π, -π) to (π, π) t = deriveTransformation(-pi, pi, 0, 0, pi, pi, 1, 0, -pi, -pi, 0, 1) self.projection = MercatorProjection(0, t) self.templates = [] while template: match = re.match(r'^(http://\S+?)(,http://\S+)?$', template) first = match.group(1) if match: self.templates.append(first) template = template[len(first):].lstrip(',') else: break
def __init__(self, template, scheme="xyz"): # the spherical mercator world tile covers (-π, -π) to (π, π) t = deriveTransformation(-pi, pi, 0, 0, pi, pi, 1, 0, -pi, -pi, 0, 1) self.projection = MercatorProjection(0, t) self.scheme = scheme self.templates = [] while template: match = re.match(r'^(http://\S+?)(,http://\S+)?$', template) first = match.group(1) if match: # normalize {x}{y}{z} to {X}{Y}{Z} first = re.sub("{[xyz]}", lambda mo: mo.group(0).upper(), first) self.templates.append(first) template = template[len(first):].lstrip(',') else: break
def __init__(self): # the spherical mercator world tile covers (-π, -π) to (π, π) t = deriveTransformation(-pi, pi, 0, 0, pi, pi, 1, 0, -pi, -pi, 0, 1) self.projection = MercatorProjection(0, t)