arguments
This commit is contained in:
19
gmap.py
19
gmap.py
@@ -5,10 +5,14 @@ from itertools import zip_longest
|
||||
import requests
|
||||
from staticmap import StaticMap, CircleMarker
|
||||
from colour import Color
|
||||
import argparse
|
||||
|
||||
green = Color("green")
|
||||
colors = list(green.range_to(Color("red"),30))
|
||||
|
||||
app_id = 0
|
||||
app_code = 0
|
||||
|
||||
def grouper(iterable, n, fillvalue=None):
|
||||
args = [iter(iterable)] * n
|
||||
return zip_longest(*args, fillvalue=fillvalue)
|
||||
@@ -24,6 +28,9 @@ class Worker(threading.Thread):
|
||||
|
||||
def run(self):
|
||||
|
||||
global app_id
|
||||
global app_code
|
||||
|
||||
destinations = ""
|
||||
for idx, tup in enumerate(self.work_items):
|
||||
if tup is not None:
|
||||
@@ -34,7 +41,7 @@ class Worker(threading.Thread):
|
||||
if tup is not None:
|
||||
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 += destinations
|
||||
|
||||
@@ -65,7 +72,7 @@ def entry():
|
||||
|
||||
home_points = []
|
||||
|
||||
range_val = 185
|
||||
range_val = 20
|
||||
for x 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):
|
||||
@@ -91,6 +98,14 @@ def entry():
|
||||
image = m.render(zoom=13)
|
||||
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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user