Plotting Tweets

Screen-Shot-2014-11-07-at-5.21.58-PM

Since figuring out how to successfully access the public twitter stream, I’ve been working on importing the map background and plotting tweets on the map based on their individual longitude and latitude values. Initially I was planning on using the Unfolding Maps library, but encountered some problems working with it in combination with Twitter4j, so for the meantime I’ve opted for a jpg background.

Since I’m only using an image as the background, I had to figure out how to accurately plot the tweets onto the map. After a bit of research I found the map() function, which allows me to set the bounding longitude and latitude values of the map background. For example, the left side of the window now has the value of¬†-123.45 instead of defaulting to 0, and the right side of the window has the value of -122.45¬†instead of the specified width.

By converting the longitude and latitude values from strings to float values, I was successfully able to plot them onto the map.

 


Leave a Reply