-
Notifications
You must be signed in to change notification settings - Fork 0
/
createmap.m
executable file
·20 lines (18 loc) · 1 KB
/
createmap.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function createmap(app, startlat, startlng, stopdata, stopnames)
%This function uses the Google Static Map API and to create a map
%with a yellow marker centered at the users location and red markers
%at the location of the stops.
markstops = getstopdata(app, stopdata, stopnames);
endpoint = 'https://maps.googleapis.com/maps/api/staticmap?';
key = '';
centerstring = sprintf("%f,%f", startlat, startlng);
centermark = strcat('color:yellow|', centerstring);
locationstring = 'color:red|';
for i = 1:length(markstops)
lat = markstops(i).attributes.latitude;
lng = markstops(i).attributes.longitude;
locationstring = strcat(locationstring, string(lat), ',', string(lng), '|');
end
[map, color] = webread(endpoint, 'size', '640x640', 'center', centerstring, 'markers', centermark, 'markers', locationstring, 'key', key);
imwrite(map, color, 'map.jpg');
end