Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Using Geo Technologies to Locate Your Boss

B92fd0f4dfb7ed14c1441e4f4cf56542?s=47 Jenny Wong
November 20, 2015

Using Geo Technologies to Locate Your Boss

Trying to find a time to catch a meeting with Joe, Human Made's CTO, can be a task in itself. He is constantly on the move, which is a problem when you are not sure what timezone or location he is in. In this talk, we will look at how we can harness technologies such as GeoIP and Geolocation to keep track of him. I will be sharing how we created a WordPress plugin that integrated Foursquare, GeoIP, and the WordPress API into an internal site; the quirks and pitfalls of these technologies; and issues that have to be considered before trying to store time zones.

B92fd0f4dfb7ed14c1441e4f4cf56542?s=128

Jenny Wong

November 20, 2015
Tweet

More Decks by Jenny Wong

Other Decks in Technology

Transcript

  1. Where s Joe?Jenny Wong CommunityEngineer @miss_jwo ,

  2. The Problem

  3. @miss_jwo #wcct

  4. @miss_jwo Distributed Company

  5. @miss_jwo Timezone Widget

  6. @miss_jwo Build a […] plugin to define working hours /

    timezones for users […] This will act as a centralised store for general working hours of the Human Made team, and will be displayed in a variety of ways. ” “
  7. Solution

  8. Define Work Hours

  9. @miss_jwo UTC all things!

  10. @miss_jwo UTC all things!

  11. @miss_jwo 09:00 - 17:00

  12. Define Time Zone

  13. UTC offsets

  14. @miss_jwo DateTimeZone::getOffset timezone_offset_get Returns the timezone offset from GMT

  15. Day light savings

  16. @miss_jwo UTC offset +/- 1

  17. @miss_jwo UK day light saving is a week early !

  18. @miss_jwo Southern hemisphere goes forward when the northern hemisphere goes

    back. !
  19. Countries

  20. @miss_jwo Countries can do what they like. !

  21. @miss_jwo China

  22. @miss_jwo

  23. @miss_jwo

  24. @miss_jwo

  25. @miss_jwo Europe

  26. @miss_jwo

  27. @miss_jwo

  28. @miss_jwo

  29. @miss_jwo

  30. @miss_jwo +/- 0.5 hours

  31. @miss_jwo +/- 0.75 hours

  32. Complexity

  33. @miss_jwo +/- 0.25 hours

  34. I don’t like you

  35. @miss_jwo +/- 0.25 hours

  36. TimeZone Abbreviations

  37. @miss_jwo Multiple Abbreviations http://en.wikipedia.org/wiki/List_of_time_zone_abbreviations

  38. @miss_jwo Multiple Abbreviations CST is not alone http://en.wikipedia.org/wiki/List_of_time_zone_abbreviations

  39. TimeZone Identifiers

  40. @miss_jwo Europe / London

  41. @miss_jwo America / New York

  42. @miss_jwo More Info: The Problem with Time & Timezones -

    Computerphile Strangest Time Zones of the World - WonderWhy
  43. @miss_jwo PHP Date Time

  44. None
  45. Auto update locations

  46. Geo Location

  47. @miss_jwo Geolocation is the identification of the real-world geographic location…

    ” “
  48. Geo IP

  49. @miss_jwo The method of associating a geographic location with the

    Internet Protocol (IP) address
  50. @miss_jwo Free Services maxmind.com/en/geoip-demo ipinfodb.com freegeoip.net telize.com

  51. @miss_jwo Paid Services maxmind.com ip2location.com db-ip.com

  52. @miss_jwo https://www.maxmind.com/en/locate-my-ip-address

  53. @miss_jwo Consider

  54. @miss_jwo Consider How much information it gives you

  55. @miss_jwo Consider How often the data is refreshed How much

    information it gives you
  56. @miss_jwo Consider How often the data is refreshed How accurate

    you need the data to be How much information it gives you
  57. @miss_jwo Consider How often the data is refreshed How accurate

    you need the data to be How reliable the service is How much information it gives you
  58. @miss_jwo Consider How often the data is refreshed How accurate

    you need the data to be How reliable the service is How much information it gives you Proxies
  59. @miss_jwo https://www.maxmind.com/en/locate-my-ip-address

  60. @miss_jwo Consider How often the data is refreshed How accurate

    you need the data to be How reliable the service is How much information it gives you Proxies
  61. Check Ins

  62. Swarm & FourSquare API

  63. @miss_jwo Real-Time API User Push API Push to your application

    every time one of your users checks in https://developer.foursquare.com/overview/realtime
  64. @miss_jwo Foursquare App

  65. @miss_jwo Foursquare Connection https://foursquare.com/oauth2/authenticate ?client_id=YOUR_CLIENT_ID &response_type=code &redirect_uri=YOUR_REGISTERED_REDIRECT_URI Direct users to

  66. @miss_jwo Foursquare Connection https://YOUR_REGISTERED_REDIRECT_URI/?code=CODE User accepts & redirected back to

    your app
  67. @miss_jwo Foursquare Connection https://foursquare.com/oauth2/access_token ?client_id=YOUR_CLIENT_ID &client_secret=YOUR_CLIENT_SECRET &grant_type=authorization_code &redirect_uri=YOUR_REGISTERED_REDIRECT_URI &code=CODE Exchange

    the code for an access token
  68. @miss_jwo Foursquare Connection { access_token: ACCESS_TOKEN } Response

  69. @miss_jwo { "id": "4e6fe1404b90c00032eeac34", "createdAt": 1315955008, "type": "checkin", "timeZoneOffset": -240,

    "user": { “id”, “firstName”, “lastName”,”photo", “gender”, “homeCity”, "relationship" }, "venue": { "id": "4ab7e57cf964a5205f7b20e3", "name": "foursquare HQ", "contact": { "twitter": "foursquare" }, "location": { "address": "East Village”, "lat": 40.72809214560253, "lng": -73.99112284183502, "city": "New York", "state": "NY", "postalCode": "10003", "country": "USA" }, "categories": [ {…} ], "verified": true, "stats": {…}, "url": "http://foursquare.com" } } https://developer.foursquare.com/overview/realtime#format Swarm Checkin
  70. @miss_jwo Request the time zone for a location on the

    earth, as well as that location's time offset from UTC. https://developers.google.com/maps/documentation/timezone Google Time Zone Requests
  71. @miss_jwo maps.googleapis.com/maps/api/timezone/ OUTPUT_FORMAT?PARAMETERS Google Time Zone Requests

  72. @miss_jwo maps.googleapis.com/maps/api/timezone/ OUTPUT_FORMAT?PARAMETERS maps.googleapis.com/maps/api/timezone/ json?location=LAT,LNG&key=YOUR_KEY Google Time Zone Requests

  73. @miss_jwo { "dstOffset" : 3600, "rawOffset" : -28800, "status" :

    "OK", "timeZoneId" : "America/Los_Angeles", "timeZoneName" : "Pacific Daylight Time" } Google Time Zone Response
  74. Result

  75. @miss_jwo HM Time

  76. github.com/humanmade/hm-time HM Time

  77. Where is Joe?

  78. New York/ USA

  79. joind.in/14810 ThaNk You

  80. Jenny Wong Community Engineer @miss_jwo joind.in/14810

  81. Questions? joind.in/14810