Yql with geo

1,946 views

Published on

Published in: Technology, Sports
1 Comment
1 Like
Statistics
Notes
No Downloads
Views
Total views
1,946
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
26
Comments
1
Likes
1
Embeds 0
No embeds

No notes for slide

Yql with geo

  1. 1. YQL and GEO Prajwal BS Developer, Hacker, Evangelist
  2. 2. Agenda•  YQL Overview•  Making Queries and the Console Sandbox•  Demo•  Geo Hacking•  YQL and GEO
  3. 3. Hacking togethersystems in 24 hours is lot of fun
  4. 4. Data manipulationHacks = + Data visualization
  5. 5. The web has lot of data around
  6. 6. ProgrammableWeb.Com – 3517 APIs
  7. 7. Yahoo! has alsoopened up its data
  8. 8. http://developer.yahoo.com/everything.html
  9. 9. The trouble with data •  You need to find data API •  Get Access – Signup for key •  Find data endpoint •  Read docs to learn what parameters you have •  Get data in obscure format •  Use data after converting and filtering •  More APIs you use, more is your annoyance
  10. 10. To make data access easy on the web,Yahoo! created YQL
  11. 11. YQL turns webservices and data on the web into databases.
  12. 12. YQL lets you accessalmost all API’s in a standardized manner.
  13. 13. API List on console
  14. 14. select {what} from {where} where {conditions}
  15. 15. You can select, filter,sort and limit data and you can even insert,update and delete from it.
  16. 16. YQL: http://developer.yahoo.com/yql/console
  17. 17. Finding Videos about IIT-MSELECT * FROM youtube.search where query=’IIT Madras
  18. 18. Selecting Photos of HackdaySELECT * FROM flickr.photos.search where text="hackday”SELECT * FROM flickr.photos.search where text="hackday” LIMIT 5
  19. 19. Inserting dataINSERT INTO bitly.shorten (login, apiKey, longUrl)VALUES (ME, API_KEY, http://yahoo.com)
  20. 20. updating dataUPDATE social.profile.statusSET status="Using YQL UPDATE”WHERE guid="NJFIDHVPVVISDX7UKED2WHU"
  21. 21. Accessing Private Data http://query.yahooapis.com/v1/yqlUses OAuth 1.0 for authorizationOAuth is complicated – use one of our SDKshttps://github.com/yahoo
  22. 22. Retrieving my profileSELECT * FROM social.contacts WHERE guid=me
  23. 23. Mix and Match severalweb services using IN command
  24. 24. Guess what this does?select * from google.translate where q in (select text from twitter.search where q=hacku) and target=hi;
  25. 25. You want more??
  26. 26. How about these formatsAtom JsonCsv MicroformatsFeed RssHtml xml
  27. 27. Company Headlines anyone?? select * from html whereurl="http://finance.yahoo.com/q? s=YHOO" and xpath=‘//div[@id="yfi_headlines"]/div[2]/ul/ li/a’
  28. 28. Company Headlines anyone??
  29. 29. Using the YQLConsole makes it very easy to use it.
  30. 30. url structurehttp://query.yahooapis.com/v1/yql?[params]http://query.yahooapis.com/v1/public/yql/ [params] Params •  q = [ YQL QUERY ] •  format = [ XML / JSON ] •  diagnostics = [ true / false ] •  debug = [ true / false ] •  callback = [ function name ]
  31. 31. Let’s See It
  32. 32. GEO HACKING•  GOOD NEWS! - Not hard to do.•  YQL as always has a solution to most geo problems.
  33. 33. REQUIREMENTS•  Finding current location.•  Turning a location into a place.•  Finding geographical hierarchy.•  Geo-tagging information.•  Displaying geo information.
  34. 34. Current Location IP Sniffing W3C geolocation APIUser Social presence (foursquare, twitter, flickr etc.)
  35. 35. REQUIREMENTS•  Finding current location.•  Turning a location into a place.•  Finding geographical hierarchy.•  Geo-tagging information.•  Displaying geo information.
  36. 36. GEOCODING AND REVERSE-GEOCODING •  converting street addresses or place names into geographic coordinates (and vice versa). h"p://developer.yahoo.com/yql/console/#h=desc%20geo.placefinder

  37. 37. YQL to the rescueselect * from geo.placefinder where text="IIT Madras India" select * from geo.placefinder where text="13.063970,80.243110" and gflags="R"
  38. 38. REQUIREMENTS•  Finding current location.•  Turning a location into a place.•  Finding geographical hierarchy.•  Geo-tagging information.•  Displaying geo information.
  39. 39. YQL GEO.PLACES.*•  geo.places.ancestors•  geo.places.belongtos•  geo.places.children•  geo.places.common•  geo.places.descendants•  geo.places.neighbors•  geo.places.parent•  geo.places.siblings
  40. 40. REQUIREMENTS•  Finding current location.•  Turning a location into a place.•  Finding geographical hierarchy.•  Geo-tagging information.•  Displaying geo information.
  41. 41. PLACEMAKER•  Takes text/web URL and extracts the geographical information from it.•  SELECT * FROM geo.placemaker WHERE documentContent = "Hey, I am in bangalore now. Will visit mumbai and delhi before going back to sunnyvale" AND documentType="text/ plain"
  42. 42. EXAMPLES•  SELECT * FROM geo.placemaker WHERE documentURL = "http://en.wikipedia.org/wiki/ Country" AND documentType="text/html”•  SELECT * FROM geo.placemaker WHERE documentURL = "http:// timesofindia.feedsportal.com/c/33039/f/ 533917/index.rss" AND documentType="text/ rss" h"p://developer.yahoo.com/geo/placemaker/

  43. 43. REQUIREMENTS•  Finding current location.•  Turning a location into a place.•  Finding geographical hierarchy.•  Geo-tagging information.•  Displaying geo information.
  44. 44. Use Maps to visualize geo data.
  45. 45. Use YQL in your hacks using Javascript.
  46. 46. USEFUL LINKS•  http://isithackday.com/hacks/geo/•  http://isithackday.com/geoplanet-explorer/• •  http://isithackday.com/hacks/geo/yql-geo-library/•  http://www.hostip.info/
  47. 47. Final Lessons: Links•  All Yahoo! APIs and Services•  http://developer.yahoo.com/everything.html•  YQL Documentation•  http://developer.yahoo.com/yql•  YQL Console•  http://developer.yahoo.com/yql/console•  YQL Github Account (Contribute Tables)•  http://github.com/yql/yql-tables
  48. 48. LETS LOCATE YOUR HACK! THANKS!! If you throw a guy on Foursquare and a guy on Twitter off a cliff, which one would hit the ground first? The guy on Twitter. The guy on Foursquare would have to stop halfway down to check in!PRAJWAL BSTwitter - @prajwalbsSlideshare - http://www.slideshare.net/prajwalbsFacebook - http://www.facebook.com/prajwalbs

×