Skip to content

Commit 687ebad

Browse files
committed
next version update
1 parent 811dc41 commit 687ebad

File tree

3 files changed

+33
-22
lines changed

3 files changed

+33
-22
lines changed

jimutmap/jimutmap.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ def get_img(self, url_str:str, vNumber:int= 9042, getMask:bool= None, prefix:str
302302
except AssertionError:
303303
try:
304304
# get the image tile and the mask tile for the same
305+
# sample sat tile: https://sat-cdn2.apple-mapkit.com/tile?style=7&size=1&scale=1&z=19&x=390843&y=228270&v=9262&accessKey=1649243787_2102081627305478489_%2F_hIz9LjsZkMj6NE7y%2BimXS9vFQbxfjLBClZR7yqyFtsE%3D&emphasis=standard&tint=light
305306
req_url = f"https://sat-cdn1.apple-mapkit.com/tile?style=7&size=1&scale=1&z={self.zoom}&x={xTile}&y={yTile}&v={vNumber}{self.ac_key}"
306307
if self.verbose:
307308
print(req_url)
@@ -334,7 +335,16 @@ def get_img(self, url_str:str, vNumber:int= 9042, getMask:bool= None, prefix:str
334335
assert exists(file_name_road)
335336
except AssertionError:
336337
for cdnLevel in range(1, 5):
337-
req_url = f"https://cdn{cdnLevel}.apple-mapkit.com/ti/tile?country=US&region=US&style=46&size=1&x={xTile}&y={yTile}&z={self.zoom}&scale=1&lang=en&v=2008184&poi=0{self.ac_key}&labels=0"
338+
# change the 2nd auth according to the datetime for downloading the roads masks
339+
today_date = str(dt.date.today())
340+
year = today_date[0:4]
341+
month = today_date[5:7]
342+
day = today_date[8:10]
343+
env_key = str(year)+str(month)+str(day)
344+
# sample road tile 1: https://cdn3.apple-mapkit.com/ti/tile?country=IN&region=IN&style=46&size=1&x=390842&y=228268&z=19&scale=1&lang=en&v=2204054&poi=1&accessKey=1649243787_2102081627305478489_%2F_hIz9LjsZkMj6NE7y%2BimXS9vFQbxfjLBClZR7yqyFtsE%3D&emphasis=standard&tint=light
345+
# sample road tile 2: https://cdn4.apple-mapkit.com/ti/tile?country=IN&region=IN&style=46&size=1&x=296223&y=176608&z=19&scale=1&lang=en&v=2204054&poi=1&accessKey=1649243787_2102081627305478489_%2F_hIz9LjsZkMj6NE7y%2BimXS9vFQbxfjLBClZR7yqyFtsE%3D&emphasis=standard&tint=light
346+
347+
req_url = f"https://cdn{cdnLevel}.apple-mapkit.com/ti/tile?country=US&region=US&style=46&size=1&x={xTile}&y={yTile}&z={self.zoom}&scale=1&lang=en&v={env_key}4&poi=1{self.ac_key}&emphasis=standard&tint=light"
338348
try:
339349
# image and mask retrieval
340350
# For the roads data

jimutmap/tiles_sticher.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def stitch_whole_tile(save_name="full_tile", folder_name="myOutputFolder"):
136136

137137
# stich the satellite imagery tile
138138

139-
SAT_TILE_FULL = np.zeros([diff_lat*256,diff_lon*256,3])
139+
SAT_TILE_FULL = np.zeros([diff_lon*256,diff_lat*256,3])
140140

141141
for lat in tqdm(range(min_lat, max_lat)):
142142
for lon in range(min_lon, max_lon):
@@ -157,7 +157,7 @@ def stitch_whole_tile(save_name="full_tile", folder_name="myOutputFolder"):
157157

158158
# stich the road imagery tile
159159

160-
ROAD_TILE_FULL = np.zeros([diff_lat*256,diff_lon*256,3])
160+
ROAD_TILE_FULL = np.zeros([diff_lon*256,diff_lat*256,3])
161161

162162
for lat in tqdm(range(min_lat, max_lat)):
163163
for lon in range(min_lon, max_lon):

test.py

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@
77
# Project Website: https://github.com/Jimut123/jimutmap
88
# ======================================================
99

10-
# Using map tiles for Kolkata, my hometown!
10+
# Using map tiles for Kolkata, Baranagar my hometown: 22.645899,88.373889,19
1111

1212
import os
1313
import glob
1414
import shutil
1515
from jimutmap import api, sanity_check, stitch_whole_tile
1616

1717

18-
download_obj = api(min_lat_deg = 22.35,
19-
max_lat_deg = 22.36,
20-
min_lon_deg = 88.0,
21-
max_lon_deg = 88.01,
18+
download_obj = api(min_lat_deg = 22.64,
19+
max_lat_deg = 22.65,
20+
min_lon_deg = 88.37,
21+
max_lon_deg = 88.38,
2222
zoom = 19,
2323
verbose = False,
2424
threads_ = 50,
@@ -32,19 +32,19 @@
3232
download_obj.download(getMasks = True)
3333

3434
# create the object of class jimutmap's api
35-
sanity_obj = api(min_lat_deg = 22.35,
36-
max_lat_deg = 22.36,
37-
min_lon_deg = 88.0,
38-
max_lon_deg = 88.01,
35+
sanity_obj = api(min_lat_deg = 22.64,
36+
max_lat_deg = 22.65,
37+
min_lon_deg = 88.37,
38+
max_lon_deg = 88.38,
3939
zoom = 19,
4040
verbose = False,
4141
threads_ = 50,
4242
container_dir = "myOutputFolder")
4343

44-
sanity_check(min_lat_deg = 22.35,
45-
max_lat_deg = 22.36,
46-
min_lon_deg = 88.0,
47-
max_lon_deg = 88.01,
44+
sanity_check(min_lat_deg = 22.64,
45+
max_lat_deg = 22.65,
46+
min_lon_deg = 88.37,
47+
max_lon_deg = 88.38,
4848
zoom = 19,
4949
verbose = False,
5050
threads_ = 50,
@@ -54,6 +54,13 @@
5454

5555
sqlite_temp_files = glob.glob('*.sqlite*')
5656

57+
58+
59+
# update_stitcher_db("myOutputFolder")
60+
# get_bbox_lat_lon()
61+
stitch_whole_tile(save_name="Kolkata", folder_name="myOutputFolder")
62+
63+
5764
print("Temporary sqlite files to be deleted = {} ? ".format(sqlite_temp_files))
5865
inp = input("(y/N) : ")
5966
if inp == 'y' or inp == 'yes' or inp == 'Y':
@@ -72,9 +79,3 @@
7279
shutil.rmtree(item)
7380
except OSError as e:
7481
print ("Error: %s - %s." % (e.filename, e.strerror))
75-
76-
77-
78-
# update_stitcher_db("myOutputFolder")
79-
# get_bbox_lat_lon()
80-
stitch_whole_tile(save_name="Kolkata", folder_name="myOutputFolder")

0 commit comments

Comments
 (0)