CS1210 Fall 2021 Discussion Section 11
Part of HW11 involves adding map markers corresponding to Tweet locations. Your task here should help with that.
Write function createMarkerString(currentTweetIndex, tweetLatLonList, mapCenterLatLon) where
- currentTweetIndex is the index (0:len(tweetLatLonList)) of the to-be-highlighted "current" tweet in your program
- tweetLatLonList is a list of items that are either None (if the corresponding tweet had no location) or a two-element lat/lon list or tuple. E.g. [[40.7452888, -73.9864273], None, [40.76056, -73.9659]]
- mapCenterLatLon is a 2-element lat/lon tuple (or list) that should be used as lat/lon whenever None appears in tweetLatLonList
The output should be a string of the form "&markers=color:red|latC,lonC&markers=color:yellow|size:small|lat0,lon0|...|latk,lonk"
where latC, lonC are the latitude and longitude of the current tweet,
and lati, loni in the yellow markers part are lats/lons for every tweet except the current one.
For example, createMarkerString(1, [[40.7452888, -73.9864273], None, [40.76056, -73.9659]], [40.758895, -73.985131])
should return "&markers=color:red|40.758895,-73.985131&markers=color:yellow|size:small|40.7452888,-73.9864273|40.76056,-73.9659"
If you complete this function correctly, you should be able to use it in HW11. It will construct a piece of the string you need in getMapUrl.
One way to test your output is to combine it with additional parts of a Google Static Map URL and
paste it into a browser address bar. For example, add the result returned by the example above to the end of
"http://maps.google.com/maps/api/staticmap?center=40.758895,-73.985131&zoom=13&size=400x400&key=YOURGOOGLEKEY" (after replacing YOURGOOGLEKEY with your key) and try it in a browser. You should get an image like:
![](ds11map.png)
Submit to ICON a python file containing the createMarkerString function