Hi FME’ers,
An attendee at a recent training course came up with a scenario for using FME, which was so good, I just had to try it out and share it with you.

This is also a great opportunity to remind you about changes to Twitter that will require you to update your workspaces, should you use a related transformer.

Asset Tracking Examples
You may have seen previous examples where we take location info from a GPS source – such as an asset tracker – and use FME to transform that info and publish it as a proper spatial feed.

The FME ServerReal-time Taxi Cabsdemo is a good example.

这是一个很好的睡觉ertisement for FME Server’s extensive capabilities; and undoubtably the method I’d recommend for a large-scale system with a lot of assets.

但它假设您已经有了一个系统在place to transmit asset locations. The solution proposed in the training course is nice because it uses an iPhone (or iPod Touch/iPad) as the GPS and a simple app to transmit the location in a way that FME can access. It’s an appropriate solution to use for one-off tracking of one or two assets, whose location only needs updating occasionally.

Geo-Enabled Tweets
There are many iPhone apps for making that link between your in-phone GPS and your Twitter account. What you need to do is find one that includes Geo-Tagging. The actual Tweet text doesn’t need to include your coordinates, but the Tweeting app must add your lat/long in the parameters it submits with the tweet.

Surprisingly (to me) not all GPS-tweeting apps do this!

You will also need to update your Twitter account settings to make it geo-enabled.

Basically, you could tell if this is all set up by querying a tweet using the Twitter api:

http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=myTwitterName

What you get should include something like this:

 49.13786075 -122.85811069 

…to prove the app is posting geotagged tweets, and something like this:

true

…to prove that the account is set up to publish that information

Simple, eh?

FME and Geo-Tagged Tweets
I’m sure there are lots of uses for geo-tagged Tweets. However, now we have Tweeted our location, what can we do with it using FME? Well remember that FME hasTwitterStatusFetcherandTweetSearchertransformers that are capable of retrieving information from Twitter.

The TwitterStatusFetcher is what I plan to use. I will enter a Twitter username and it will retrieve recent posts from that user. If the posts are geo-tagged, and the Twitter account is geo-enabled, then we will get geometry back showing a location.

Here’s a simple workspace which will do just that.

TheCreatorcreates a single null feature to kick off the process, and the only parameter needed in the TwitterStatusFetcher is the Twitter username (and password, if it is a protected timeline).

TheGeometryFilteris only there to prove that one of the tweets is geo-tagged, and that FME recognized that and converted it automatically to a point geometry.

Because the TwitterStatusFetcher actually retrieves the last 20 tweets we can track where an asset is now, and where it has been.

Publishing the Results
Now we have a point feature representing a location we should probably do something with it like make it available for public consumption. The FME Server Taxi example uses a KMLNetworkLink, which pings the server at every refresh for a new update, but I can’t do that with Desktop and I don’t really need such regular updates.

So, this is where the second part of the trainee’s idea comes into play: we turn it into a GeoRSS feed.

Publishing this info as GeoRSS means we can set up a very quick and dirty way of publishing the info that any GeoRSS client (such as Google Maps) can consume.

What I could do, of course, is write the data out as a GeoRSS dataset and upload it somewhere manually. But I’m going to set up a workspace which does it all (click to enlarge):

This workspace takes the output feature and turns it into a GeoRSS dataset using theGeoRSSFeatureExtractortransformer. I can’t write this directly as a file to a web site (I don’t think) but what I can do is write it out to a local file with theAttributeFileWriterand then upload that file using theHTTPFileUploader.

I persuaded one of our developers, Graeme, to help me out with a quick demo. I used the workspace above and here’s a visualization of the resulting feed, created using the excellentGeoCommons.

Now whenever I want to know where Graeme is, I can run the workspace and update his location based on his last Twitter post. Looks like he’s at work today. Perhaps I’ll run it again at 4pm to see if he’s trying to sneak out early today!

Reminder
This article provides a timely opportunity to remind you to update your Twitter transformers.

Twitter isshutting off basic authentication, which means we had to update FME’s Twitter-related transformers, and that FME users have to replace them in their workspace using a newer FME such as 2010SP2 or 2011-beta.

Unfortunately simply updating to a newer FME will not be enough; you have to also replace the transformers themselves.

Many thanks to:
Graeme in our development team for using his iPhone and Twitter account as a test subject, and to Paul Schneider down in Georgia for the great idea.

About FME Attributes Data Transformation FME桌面 GeoCommons Geometry GeoRSS GPS HTTP IPhone Twitter

Mark Ireland

Mark, aka iMark, is the FME Evangelist (est. 2004) and has a passion for FME Training. He likes being able to help people understand and use technology in new and interesting ways. One of his other passions is football (aka. Soccer). He likes both technology and soccer so much that he wrote an article about the two together! Who would’ve thought? (Answer: iMark)

相关的帖子