In Part 1 of this series we saw how to setup a connection in Oracle Stream Analytics to Twitter and create a Tweet stream. In this part we will investigate using the OSA map and geo-spatial exploration features to display the tweet point of origin on a map.
Notice that tweets do not by default include the location information (latitude and longitude) of the post. Missing location data is set to minus one on the tweet as shown below.
In order to include location information, post from a mobile device that has location (GPS) hardware. Enable location on the tweet and turn on "Share precise location" as shown below.
Now that we have tweets with location information the next step is to create a map display in OSA to get visual display of point of origin.
The map item allows you to set a rectangular region of the globe and "geo fences" which will display highlighted markers if location data in the stream is contained within the fence. Start by creating a new Map item,
enter a name and type for the map, we're using manual type here.
Zoom in or out to set the global region and draw the one or more geo fence areas as a closed loop on the map.
Next we need to define the exploration as a Pattern and link the Twitter stream to the map. Create a new Pattern based exploration,
and select Spatial General for the pattern type.
Use the Map and Event Stream items we have already created and select latitude and longitude location data. We want marker highlight for tweets inside geo fence so select only "Enter" for tracking and leave the coordinate system default 8307.
Publish the exploration and we are finished. As Tweets arrive in the Twitter feed stream they will display as markers on the map.
In the next installment we'll take a look at using content analysis on the text of the tweet stream to track sentiment information.