-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgmplot_maps.py
More file actions
26 lines (23 loc) · 1012 Bytes
/
gmplot_maps.py
File metadata and controls
26 lines (23 loc) · 1012 Bytes
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
import gmplot
import os
if __name__ == "__main__":
#Required variables. Please refer to the README to know what each variable does
center = [26.519608, 80.232266]
zoom = 20
size = 10
#Opening gps.txt and reading the coordinates. num_coords specifies the number of points to marks
f = open(os.path.expanduser('~') + '/.ros/router/gps.txt')
text = f.read()
list_words = text.split('\n')
num_coords = (int)(list_words[0])
#Constructing the list of latitudes and longitudes
latitude_list = []
longitude_list = []
for i in range (1,num_coords+1):
lat,lon = list_words[i].split(' ')
latitude_list.append(float(lat))
longitude_list.append(float(lon))
#Plotting the map with the requisite markers and storing it
gmap = gmplot.GoogleMapPlotter(center[0], center[1], zoom)
gmap.scatter( latitude_list, longitude_list, '# FF0000', size, marker = False )
gmap.draw(os.path.expanduser('~')+'/.ros/router/map.html')