building crowd-sourcing and social media into your gis€¦ · anatomy of a tweet downtown la....

30
Building Crowd-Sourcing and Social Media into your GIS @agup, @AL_Laframboise

Upload: others

Post on 30-Apr-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Building Crowd-Sourcing and Social Media into your GIS

@agup, @AL_Laframboise

Agenda

• Tweets and Geolocation• Using the Twitter APIs• Research and Development

Anatomy of a tweet

Downtown LA. Traffic accident on I10. Backed up for miles. Anyone know how the I60 is? #Traffic

WhatWhat’’s happening?s happening?

To whom?To whom?

GeolocationGeolocation??

34.063634.0636

‐‐117.5922117.5922

How do I access Twitter location data?

Search API + geocode•Twitter geotag <twitter:geo>

•Profile location <google:location>

•The tweet content (text and/or hashtags)

REST API•User status <location>

STREAMS API•locations (bounding box)

Architectures for integrated Tweets

• Client only- Browser- Desktop (e.g. Adobe AIR)

• Client/Server

Client-only

Web Web

WebWebClientClient

BasemapBasemap

Geo ServicesGeo Services

TwitterTwitter

GeodatabaseGeodatabase

ArcGIS ServerArcGIS Online

Demo

http://esriurl.com/twittersearchwidget

Twitter Search by Location/Radius

http://search.twitter.com/search.atom?geocode=37.781157,-122.398720,1mi

‘ Geolocation enabled<google:location>37.786600, -122.397200</google:location><twitter:geo>

<georss:point>37.7866 -122.3972</georss:point></twitter:geo>

‘ Geolocation not enabled<google:location>&#220;T: 37.784495,-122.393847</google:location>

<twitter:geo></twitter:geo>

Geo-components of radius search payload<entry>

<id>tag:search.twitter.com,2005:45270965835407360</id><published>2011-03-08T23:53:34Z</published><link type="text/html"

href="http://twitter.com/cobradave/statuses/45270965835407360" rel="alternate"/>

<title>@AvaAddams even tho prefer the usual size, thanks for sharing the pic :)</title>

<content type="html">&lt;a href=&quot;http://twitter.com/AvaAddams&quot;&gt;@AvaAddams&lt;/a&gt; even tho prefer the usual size, thanks for sharing the pic :)</content>

<updated>2011-03-08T23:53:34Z</updated><link type="image/png"

href="http://a2.twimg.com/profile_images/82614151/bg_davy_icon_normal.j pg" rel="image"/>

<google:location>37.786600, -122.397200</google:location><twitter:geo>

<georss:point>37.7866 -122.3972</georss:point></twitter:geo>****

</entry>

Twitter Search by Keyword

http://search.twitter.com/search.atom?q=devsummit

‘ Geolocation enabled<twitter:geo>

<georss:point>37.7866 -122.3972</georss:point></twitter:geo>

‘ Geolocation not enabled<twitter:geo></twitter:geo>

Geo-components of keyword search payload

<entry><id>tag:search.twitter.com,2005:45341439764348929</id><published>2011-03-09T04:33:36Z</published><link type="text/html"

href="http://twitter.com/ronboug/statuses/45341439764348929" rel="alternate"/>

<title>RT @timoreilly: Cool hack by @sharpgis lets you control a map, kinect-style. I try it. Pic via @RyanResella http://bit.ly/eKvs4v at ESRI #devsummit</title>

<content type="html">RT &lt;a ........</content><updated>2011-03-09T04:33:36Z</updated><link type="image/png"

href="http://a0.twimg.com/profile_images/319278276/topStory6_n ormal.jpg" rel="image"/>

<twitter:geo></twitter:geo>****

</entry>

Twitter Status by Id

http://api.twitter.com/1/statuses/show/45341439764348929.xml?include_entities=true

<user><id>2384071</id> <name>Tim O'Reilly</name><screen_name>timoreilly</screen_name><location>Sebastopol, CA</location>***<geo_enabled>true</geo_enabled>

Client-side Twitter Request (GET or POST)

try{

var reqURI:String = PROXY_SERVER + "tweetcmd.php?" + attrs;

var httpService:HTTPService = new HTTPService;httpService.url = reqURI;httpService.requestTimeout = 30; httpService.useProxy = false;httpService.method = "GET"; httpService.resultFormat = "text"; //IMPORTANT: you must use the 'text' valuehttpService.addEventListener( "result", twitterSearchResult );httpService.addEventListener( "fault", twitterSearchFault );httpService.showBusyCursor = true;httpService.send();

}catch( error:Error ){

dispatchEvent(new TweetEvent(TweetEvent.SEARCH_FAILED,error.getStackTrace()));

}

Client-side Response Parsing (XML or JSON)for each(var element:Object in atom.entries)

{

//trace("atom: " + element.xml); //just for debugging

var geometry:String = "";

var baseNode:XMLList = element.xml;

var id:String = element.id;

var title:String = element.title;

var imageURL:String = element.links[1].href;

var nameTemporary:String = element.authors[0].name;

var name:String = (nameTemporary).split(" " )[0];

var published:String = publishedDateFormatter(element.published);

var google:Namespace = baseNode.namespace("google");

var twitter:Namespace = baseNode.namespace("twitter");

var googleLocation:String = baseNode.google::location;

var geoLocation:XMLList = baseNode.twitter::geo;

//To prevent parsing errors

if(geoLocation.namespace("georss"))

{

var geoNS:Namespace = geoLocation.namespace("georss");

twitterLocation = geoLocation.geoNS::point;

}

**

**

**

Research and Development

ArcGIS Explorer

ArcGIS Explorer – Twitter Add-in

http://tinyurl.com/agxtwitter

Framework

Login (oAuth)

Token

Authorization

Cache

Getting Friends and Favorites (oAuth)

Friends

Favorites

Search by distance or keyword (oAuth)

Search by Radius- Optional keyword

Search- Optional keyword

GeoTagging – Are you enabled?

Ask user!

See Twitter dev guide!

GeoTagging Tweets

Append coordinates

Users must geo-enable (opt-in) accounts

string url = http://api.twitter.com/statuses/update.xml;string status = “At the Devsummit learning lots of cool things… #devsummit”;

string request = string.Format("lat={0}&long={1}&status={2}", lat, lon, status);

‘ Geolocation enabled</user>

<geo xmlns:georss="http://www.georss.org/georss"> <georss:point>34.056758 -117.196006</georss:point>

</geo></status>

‘ Geolocation not enabled</user>

<geo /></status>

34.063634.0636

‐‐117.5922117.5922

Geolocation = Spatial Context

Learn more…

http://support.twitter.com/forums/26810/entries/78525

Features

Geocode Tweets

GeoTag Tweets

Show GeoTag

Zoom Levels

2D/3D

Search

Float or Pin

Show Notes

Follow Users

Unfollow Users

Challenges

• Point dispersion

• Paging (1500)

• Storage

• Search Limitations (7-days)

• Rate Limits

Development Considerations

• Choose Twitter API(s) • Native HTTP request/response• Authentication• Parsing out location data• Rate Limits

- IP Address Whitelisting (contact Twitter)*

• Storing data limitations (contact Twitter)*

*Email: [email protected]

Questions