Traffic map timstamp

Added a timestamp to the traffic maps so you know how much it's aged.
This commit is contained in:
markjfine 2021-03-29 19:19:58 -04:00 committed by GitHub
parent 19368510f3
commit 5a4886ad65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -891,7 +891,13 @@ class NRSC5_DUI(object):
tileFile = os.path.join(mapDir, "TrafficMap_{:g}_{:g}.png".format(i,j)) # get path to tile
imgMap.paste(Image.open(tileFile), (j*200, i*200)) # paste tile into map
os.remove(tileFile) # delete tile image
# now put a timestamp on it.
imgMap = imgMap.convert("RGBA")
posTS = (imgMap.size[0]-235, imgMap.size[1]-29) # calculate position to put timestamp (bottom right)
imgTS = self.mkTimestamp(t, imgMap.size, posTS) # create timestamp
imgMap = Image.alpha_composite(imgMap, imgTS) # overlay timestamp
imgMap.save(os.path.join(mapDir, "TrafficMap.png")) # save traffic map
# display on map page