示例#1
0
                    print('.', end='')
                    time.sleep(1)

                #download
                print("DL tile(%d,%d,%d)...%d/%d" %
                      (level, x, y, count, total))
                job = lambda: downloadJob(map, level, x, y)
                th = Thread(target=job)
                with thread_lock:
                    thread_pool.append(th)
                th.start()


if __name__ == '__main__':
    cdir = sys.argv[1] if len(sys.argv) > 1 else CACHE_DIR

    #TM25Kv3
    map = tile.getTM25Kv3TileMap(cache_dir=cdir)
    try:
        #main island of Taiwan
        low_lat, up_lat = 21.876792, 25.373809
        left_lon, right_lon = 120.020142, 122.025146
        downloadArea(map, low_lat, up_lat, left_lon, right_lon)

        #penghu
        low_lat, up_lat = 23.122995, 23.877676
        left_lon, right_lon = 119.383106, 119.758186
        downloadArea(map, low_lat, up_lat, left_lon, right_lon)
    finally:
        map.close()
示例#2
0
#!/usr/bin/env python3

import sys
sys.path.insert(0, 'src')

import os
import shutil
import tile

if __name__ == '__main__':
    src_dir = '/home/dayanuyim/DropboxExt/mapcache/TM25K_2001'
    dst_dir = '/home/dayanuyim/DropboxExt/mapcache'

    tm = tile.getTM25Kv3TileMap('/tmp', False)
    db = tile.DBLocalCache(dst_dir, tm, is_concurrency=False)
    db.start()
    try:
        for dirpath, dirnames, filenames in os.walk(src_dir):
            map_id = os.path.basename(os.path.dirname(dirpath))
            print('Reading the dir:', dirpath)
            for f in filenames:
                #parse level, x, y
                tokens = f.split('-')
                if len(tokens) != 3:
                    print('not target file: %s, %s', (dirpath, f))
                    continue
                level = int(tokens[0])
                x = int(tokens[1])
                y = int(tokens[2].split('.')[0])

                #read file into DB
示例#3
0
                    print('.', end='')
                    time.sleep(1)

                #download
                print("DL tile(%d,%d,%d)...%d/%d" % (level, x, y, count, total))
                job = lambda: downloadJob(map, level, x, y)
                th = Thread(target=job)
                with thread_lock:
                    thread_pool.append(th)
                th.start()

if __name__ == '__main__':
    cdir = sys.argv[1] if len(sys.argv) > 1 else CACHE_DIR

    #TM25Kv3
    map = tile.getTM25Kv3TileMap(cache_dir=cdir)
    try:
        #main island of Taiwan
        low_lat, up_lat = 21.876792, 25.373809
        left_lon, right_lon = 120.020142, 122.025146
        downloadArea(map, low_lat, up_lat, left_lon, right_lon)

        #penghu
        low_lat, up_lat = 23.122995, 23.877676
        left_lon, right_lon = 119.383106, 119.758186
        downloadArea(map, low_lat, up_lat, left_lon, right_lon)
    finally:
        map.close()


示例#4
0
#!/usr/bin/env python3

import sys
sys.path.insert(0, 'src')

import os
import shutil
import tile


if __name__ == '__main__':
    src_dir = '/home/dayanuyim/DropboxExt/mapcache/TM25K_2001'
    dst_dir = '/home/dayanuyim/DropboxExt/mapcache'

    tm = tile.getTM25Kv3TileMap('/tmp', False)
    db = tile.DBLocalCache(dst_dir, tm, is_concurrency=False)
    db.start()
    try:
        for dirpath, dirnames, filenames in os.walk(src_dir):
            map_id = os.path.basename(os.path.dirname(dirpath))
            print('Reading the dir:', dirpath)
            for f in filenames:
                #parse level, x, y
                tokens = f.split('-')
                if len(tokens) != 3:
                    print('not target file: %s, %s', (dirpath, f))
                    continue
                level = int(tokens[0])
                x = int(tokens[1])
                y = int(tokens[2].split('.')[0])