Sample and Demos

Geotagged Tweets in KML

Article Number: 000001483 - Last Modified: Jul 23, 2015

This article describes how FME Server can be used to search, geocode, store and serve tweets as KML.

Scenario

This example demonstrates how FME Server can be used to:
  • search for tweets with specific text, hash tags or users,
  • provide the tweet with a spatial location by (a) utilizing the new Twitter Geotagging capability if provided or (b) geocoding the tweeter's profile location,
  • write the spatially aware tweets out as KML and
  • serve the KML using the KML Network Link Service for viewing in Google Maps and Google Earth.

How It Works

As with most FME Server scenarios, a workspace is designed using FME Desktop (Workbench) and uploaded to FME Server - in this case three workspaces.

Workspaces

Tweet Search and Archive (D008-tweet-archiver.fmw)

The first workspace searches for tweets that contain the text @safesoftware OR @fmedoctors OR @fmeevangelist OR @betabuilder. If a tweet isn't geotagged, an attempt is made to give the tweet a location by geocoding the tweeter's profile location. Ultimately, the tweets are output into a database for retrieval by another workspace that outputs KML. This intermediate or caching database is required to avoid exceeding the Twitter API rate limit of 150 requests per hour.

KML Output (D008-tweet-kml.fmw)

The second workspace reads the cached tweets, nostyles each tweet for KML and then writes them out to KML. This workspace is published to FME Server and registered with the KML Network Link Service.

Tweet Search and Archive Runner (D008-tweet-archive-runner.fmw) A third workspace uses the FMEServerJobSubmitter transformer to run the Tweet Search and Archive workspace on FME Server. The workspace is run at a set interval using a bat file. The interval is set to a value that won't exceed the Twitter API rate limit of 150 requests per hour.
 

Setting up the Example

To actually set up and run the example on your own system requires a certain set of software and setup.

Requirements

  • MySQL
  • FME Server 2011+
  • FME Desktop 2011+
  • workspaces and required files

Steps

  • Download the workspaces and required files zip file.
  • Extract the zip file into C:\FMEDemos.
  • Open the following readme file and follow the directions inside:
    • C:\FMEDemos\D008 - Geo-Twitter\Documentation\readme.txt

Suggested Similar Articles

This example uses FME Server to receive real-time mobile asset locations, publish them to KML, determine if their an asset is inside of a geofence and if so a message is tweeted.

This details how to convert vector points to raster using rasterization and then how to display them intelligently in KML using Regions.

Read a COLLADA model file and place it at each location as defined in a set of input points then write the result to KML

Read and translate KML data, in this basic KML to MapInfo TAB translation.

This demo demonstrates how you can display and update data within Google Earth with FME Server's Data Streaming service and the KML Network Link Control.