-
Notifications
You must be signed in to change notification settings - Fork 20
BONUS Part 6. Add Tweet Locations

Want to add maps to your dashboard that show which areas of the world are the most positive/negative/neutral?
Just run the pubnubStreamLocation.py script or the pubnubStreamLocation.js script instead!
But first you have to get a Google API key and install the geolocation module based on Google Maps.
From the geolocation python page:
- Visit the APIs console at https://code.google.com/apis/console and log in with your Google account
- Click the Services link from the left-hand menu and activate the Geocoding API service
- Your API key should now be available from the API Access page in the Simple API Access section
Copy-paste this key into line 8.
Install the geolocation module:
pip install geolocation-python
Install the geolocation module:
npm install @google/maps
Note: If you receive a permissions error, add "sudo" to the front of the command
To get location data from Twitter and then stream it based on the associated tweet's score, I just added 2 lines to the IBM Watson block inside of my PubNub app. You can copy that block code here. Be sure to put your IBM API key on line 13!
Add your PubNub subscribe and publish keys to this script too!
The Map tiles should automatically pop up inside of your Initial State bucket.
<< Part 5: Your Personal Dashboard - BONUS - Part 7: The Unlimited Stream >>
Initial State (https://www.initialstate.com)
(c) 2018 Initial State Technologies, Inc.