13.15 Geocoding and Mapping
In this section, we’ll collect streaming tweets, then plot the locations of those tweets. Most tweets do not include latitude and longitude coordinates, because Twitter disables this by default for all users. Those who wish to include their precise location in tweets must opt into that feature. Though most tweets do not include precise location information, a large percentage include the user’s home location information; however, even that is sometimes invalid, such as “Far Away” or a fictitious location from a user’s favorite movie.
In this section, for simplicity, we’ll use the location
property of the tweet’s User
object to plot that user’s location on an interactive map. The map will let you zoom in and out and ...
Get Intro to Python for Computer Science and Data Science: Learning to Program with AI, Big Data and The Cloud now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.