-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMAP MAKER.py
35 lines (24 loc) · 2.22 KB
/
MAP MAKER.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
import requests
from tkinter import *
def click1():
latco= lat.get()
longco= long.get()
url= ("https://api.mapbox.com/styles/v1/mapbox/streets-v11/static/"+longco + "," + latco + ",14.25,0,60/600x600?access_token=pk.eyJ1IjoibWFjaGV0ZTg5IiwiYSI6ImNqeXh3ZDd1YTEzZWwzY21sdGx2bnhwM3gifQ.MbW6tttXkNk1p24wviwHQw") # Gets a map at longco, latco
# zoom 14.24, bearing 0, and pitch 60
# 600 pixels wide and 600 pixels high map is obtained
# access_token is obtained after creating a mapbox account
r=requests.get(url)
with open('test.jpeg', 'wb') as f:
f.write(r.content)
window = Tk()
window.title (" Project ")
window.geometry("350x250")
Label (window, text = "Enter the lat (-90 to 90)", font='calibri 10').place(relx = 0.3, rely = 0.3, anchor = CENTER)
lat = Entry(window, width =20, bg= 'white')
lat.place(relx = 0.7, rely = 0.3, anchor = CENTER)
Label(window, text="Enter the long (-180 to 180)", font='calibri 10').place(relx = 0.3, rely = 0.5, anchor = CENTER)
long= Entry(window, width= 20, bg= 'white')
long.place(relx = 0.7, rely = 0.5, anchor = CENTER)
Button(window, text=("create map 1"), width=10, command =click1).place(relx = 0.5, rely = 0.65, anchor = CENTER)
Button(window, text=("create map 2"), width=10, ).place(relx = 0.5, rely = 0.8, anchor = CENTER) #insert command= <function name>
window.mainloop()