branch
mitchellhansen 4 years ago
parent dcc7d9cd00
commit 7d3a33207f

@ -5,10 +5,14 @@ from itertools import zip_longest
import requests import requests
from staticmap import StaticMap, CircleMarker from staticmap import StaticMap, CircleMarker
from colour import Color from colour import Color
import argparse
green = Color("green") green = Color("green")
colors = list(green.range_to(Color("red"),30)) colors = list(green.range_to(Color("red"),30))
app_id = 0
app_code = 0
def grouper(iterable, n, fillvalue=None): def grouper(iterable, n, fillvalue=None):
args = [iter(iterable)] * n args = [iter(iterable)] * n
return zip_longest(*args, fillvalue=fillvalue) return zip_longest(*args, fillvalue=fillvalue)
@ -24,6 +28,9 @@ class Worker(threading.Thread):
def run(self): def run(self):
global app_id
global app_code
destinations = "" destinations = ""
for idx, tup in enumerate(self.work_items): for idx, tup in enumerate(self.work_items):
if tup is not None: if tup is not None:
@ -34,7 +41,7 @@ class Worker(threading.Thread):
if tup is not None: if tup is not None:
starts += "&start" + str(idx) + "=" + str(tup[1]) + "," + str(tup[0]) starts += "&start" + str(idx) + "=" + str(tup[1]) + "," + str(tup[0])
urls = "https://matrix.route.api.here.com/routing/7.2/calculatematrix.json?app_id=EpknDhPDW5TutJYG7XAC&app_code=t9FZUznFGJviX-aPBM5PfA&departure=2018-12-21T01:00:00&mode=fastest;car;traffic:enabled&summaryAttributes=traveltime&start=" urls = "https://matrix.route.api.here.com/routing/7.2/calculatematrix.json?app_id={0}&app_code={1}&departure=2018-12-21T01:00:00&mode=fastest;car;traffic:enabled&summaryAttributes=traveltime&start=".format(app_id, app_code)
urls += str(self.destination[1]) + "," + str(self.destination[0]) urls += str(self.destination[1]) + "," + str(self.destination[0])
urls += destinations urls += destinations
@ -65,7 +72,7 @@ def entry():
home_points = [] home_points = []
range_val = 185 range_val = 20
for x in range(-range_val, range_val): for x in range(-range_val, range_val):
for y in range(-range_val, range_val): for y in range(-range_val, range_val):
#if (x > 148 or x < -148) or (y > 148 or y < -148): #if (x > 148 or x < -148) or (y > 148 or y < -148):
@ -91,6 +98,14 @@ def entry():
image = m.render(zoom=13) image = m.render(zoom=13)
image.save('maps.png') image.save('maps.png')
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("app_id", help="")
parser.add_argument("app_code", help="")
args = parser.parse_args()
app_id = args.app_id
app_code = args.app_code
entry() entry()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 MiB

After

Width:  |  Height:  |  Size: 5.8 MiB

Loading…
Cancel
Save