Intro to Python for Computer Science and Data Science: Learning to Program with AI, Big Data and The Cloud
by Paul J. Deitel, Harvey M. Deitel
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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access