forked from Jimut123/jimutmap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
81 lines (62 loc) · 2.54 KB
/
test.py
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# ======================================================
# This tests the working of jimutmap package.
# Note this doesnot uses multi-processing
# OPEN SOURCED UNDER GPL-V3.0.
# Author : Jimut Bahan Pal | [email protected]
# Project Website: https://github.com/Jimut123/jimutmap
# ======================================================
# Using map tiles for Kolkata, Baranagar my hometown: 22.645899,88.373889,19
import os
import glob
import shutil
from jimutmap import api, sanity_check, stitch_whole_tile
download_obj = api(min_lat_deg = 22.64,
max_lat_deg = 22.65,
min_lon_deg = 88.37,
max_lon_deg = 88.38,
zoom = 19,
verbose = False,
threads_ = 50,
container_dir = "myOutputFolder")
# If you don't have Chrome and can't take advantage of the auto access key fetch, set
# a.ac_key = ACCESS_KEY_STRING
# here
# getMasks = False if you just need the tiles
download_obj.download(getMasks = True)
# create the object of class jimutmap's api
sanity_obj = api(min_lat_deg = 22.64,
max_lat_deg = 22.65,
min_lon_deg = 88.37,
max_lon_deg = 88.38,
zoom = 19,
verbose = False,
threads_ = 50,
container_dir = "myOutputFolder")
sanity_check(min_lat_deg = 22.64,
max_lat_deg = 22.65,
min_lon_deg = 88.37,
max_lon_deg = 88.38,
zoom = 19,
verbose = False,
threads_ = 50,
container_dir = "myOutputFolder")
print("Cleaning up... hold on")
sqlite_temp_files = glob.glob('*.sqlite*')
# update_stitcher_db("myOutputFolder")
# get_bbox_lat_lon()
stitch_whole_tile(save_name="Kolkata", folder_name="myOutputFolder")
print("Temporary sqlite files to be deleted = {} ? ".format(sqlite_temp_files))
inp = input("(y/N) : ")
if inp == 'y' or inp == 'yes' or inp == 'Y':
for item in sqlite_temp_files:
os.remove(item)
## Try to remove tree; if failed show an error using try...except on screen
try:
chromdriver_folders = glob.glob('[0-9]*')
print("Temporary chromedriver folders to be deleted = {} ? ".format(chromdriver_folders))
inp = input("(y/N) : ")
if inp == 'y' or inp == 'yes' or inp == 'Y':
for item in chromdriver_folders:
shutil.rmtree(item)
except OSError as e:
print ("Error: %s - %s." % (e.filename, e.strerror))