Пример #1
0
def overview(N,typ,dat,width=256,height=256,color=(255,90,0),C=None,CS=None):
    if not C: C = classification.random(N,3)
    #if not CS: CS = fade(steps=1,left=color,right=color,borders=(0,0,0))
    if not CS: CS = fade(steps=C.n,borders=(0,0,0))
    #if typ in 'CD':
    #    dat = base64.b64decode(dat)
    if typ == 'B':
        dat = int(dat)
    return TILE_TYPE_DISPATCH[typ](C,CS,dat,width,height)
Пример #2
0
def cache_file_to_PNGs(tileData='/Users/charlie/Documents/data/usa/usa_cache.csv',N=3111):
    """ This function is designed to help Demo and Profile the rendering code,
        It processes a txt file containing the output of the DynTileMapper GUI
        Each line the in txt file is turned into a PNG image with a random classification
    """
    C = classification.random(N,200)
    CS = fade(steps=198,left=(255,255,0),right=(0,255,255),borders=(255,0,0))
    f = open(tileData,'r')
    header = f.next() #header
    for line in f:
        z,x,y,tileType,tile = line.strip().split(',')
        fname = '%s+%s+%s.png'%(z,x,y)
        if tileType in 'CD':
            tile = base64.b64decode(tile)
        elif tileType == 'B':
            tile = int(tile)
        s = TILE_TYPE_DISPATCH[tileType](C,CS,tile)
        o = open('out/'+fname,'wb')
        o.write(s)
        o.close()