-
Notifications
You must be signed in to change notification settings - Fork 0
/
basic_map.py
59 lines (47 loc) · 1.4 KB
/
basic_map.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import matplotlib.pyplot as plt
import pandas as pd
import sqlite3
import datetime
from mpl_toolkits.basemap import Basemap
today = datetime.date.today().strftime('%B %d, %Y')
# DataFrame of Latitude and Longitude
columns = [
'Latitude',
'Longitude',
]
con = sqlite3.connect(r'C:\Users\Alex\Desktop\hello\Python\cfs\cfs_1.db')
cur = con.cursor()
cur.execute('''SELECT
latitude,
longitude
FROM
cfs_jobs
WHERE
job_industry = 'Information Technology'
AND job_salary_range_low != ''
AND latitude != -999;
''')
data = cur.fetchall()
con.close()
df = pd.DataFrame(data=data, columns=columns)
fig = plt.figure(figsize=(15,12))
m = Basemap(
projection='mill',
llcrnrlat=14,
urcrnrlat=56,
llcrnrlon=-140,
urcrnrlon=-52,
resolution='c'
)
m.drawcoastlines()
m.drawcountries(color='black', linewidth=1)
m.drawstates(color='black', linewidth=1)
m.drawmapboundary(fill_color='aqua')
m.fillcontinents(color='lightgreen', lake_color='aqua')
# m.etopo()
m.scatter(df['Longitude'].tolist(), df['Latitude'].tolist(), latlon=True, s=30, c='red', marker='.', edgecolor='k')
# m.bluemarble()
# m.drawcounties(color='orange')
# m.drawrivers(color='blue')
plt.title(label=f'CFS Jobs (Salaried) - As of {today}', fontsize=20, color='white')
plt.show()