W3C Geolocation API - Making Websites Location-aware

30,069 views

Published on

my slides from the Web 2.0 Expo session on the W3C Geolocation API

Published in: Technology, Business
  • www.giite.com

    We provide various Online & Classroom courses to help you achieve your goals.
    GIITE Training is the fastest way to match you with IT market Industry, whether you want to learn from home or take virtual classes,
    You will find the ultimate in convenience and instructions when you understand the benefits of our training program.
    It is known that the field of IT training has been a fast growing area of expertise in recent years, In order to keep up and adjust to its expansion in the technology world, verity of IT Training courses have been developed and IS now being offered to yo
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Nice overview thanks. When I worked at MapQuest back in the day one very important issue that MapQuest couldn't solve was customer feedback of the form 'That's not my beautiful house' when our geolocater got it wrong, we could not correct it. How do we put customer feedback into these systems?
    Do any allow me to update the geolocation of my wifi when I move to a new city?
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

W3C Geolocation API - Making Websites Location-aware

  1. 1. W3C Geolocation API Making Websites Location-aware Wednesday, April 1, 2009
  2. 2. me • Director of Consumer Products at Skyhook Wireless • Founded Locationaware.org which eventually became W3C Geolocation API Working Group • Follow @rsarver to get the SlideShare link for slides after I post them Wednesday, April 1, 2009
  3. 3. practical tools to allow you to add location capabilities to your website today Wednesday, April 1, 2009
  4. 4. What is Geolocation? History of Geolocation on the web Current State of the Union Location Technologies Code Examples Questions Wednesday, April 1, 2009
  5. 5. location = context Wednesday, April 1, 2009
  6. 6. higher context = relevancy Wednesday, April 1, 2009
  7. 7. higher location = relevancy Wednesday, April 1, 2009
  8. 8. location comes in many flavors Wednesday, April 1, 2009
  9. 9. 37.78467, -122.40162 Wednesday, April 1, 2009
  10. 10. Wednesday, April 1, 2009
  11. 11. 747 Howard St, San Francisco, CA Wednesday, April 1, 2009
  12. 12. 4th St & Howard St Wednesday, April 1, 2009
  13. 13. Soma Wednesday, April 1, 2009
  14. 14. Pete’s Coffee Wednesday, April 1, 2009
  15. 15. Business Search APIs • Yahoo Local Search API • Yelp API • Localeze - sells business listing information • small businesses are tough, no db is totally complete Wednesday, April 1, 2009
  16. 16. how you display it can be used as a way of blurring location Wednesday, April 1, 2009
  17. 17. Ryan checked into The Mission Wednesday, April 1, 2009
  18. 18. map markers can be misleading when dealing with user’s location ... maybe use text instead Wednesday, April 1, 2009
  19. 19. Wednesday, April 1, 2009
  20. 20. Wednesday, April 1, 2009
  21. 21. so, why should I use it? Wednesday, April 1, 2009
  22. 22. Wednesday, April 1, 2009
  23. 23. HISTORY a lot has changed in a year Wednesday, April 1, 2009
  24. 24. Wednesday, April 1, 2009
  25. 25. locationaware.org Wednesday, April 1, 2009
  26. 26. Google Gears Wednesday, April 1, 2009
  27. 27. W3C Geolocation API Wednesday, April 1, 2009
  28. 28. coalition of the willing Wednesday, April 1, 2009
  29. 29. state of the union http://www.flickr.com/photos/xrrr/2478140383/ Wednesday, April 1, 2009
  30. 30. 2009 is the year of location in the Browser Wednesday, April 1, 2009
  31. 31. • Geode Extension in Mozilla Labs. Powered by Skyhook • W3C Geolocation API support natively in 3.1 (now called 3.5) • Opera Labs release with W3C Geolocation API support. Powered by Skyhook • Support in Chrome for Windows and Android Wednesday, April 1, 2009
  32. 32. http://bit.ly/mozilla-geode http://bit.ly/opera-geolocation http://google.com/chrome Wednesday, April 1, 2009
  33. 33. Location Technologies Wednesday, April 1, 2009
  34. 34. Two primary methods 1. IP Geolocation 2. Triangulation • GPS • Wi-Fi • Cell Tower Wednesday, April 1, 2009
  35. 35. IP Geolocation Pros • Widely available • Detection happens server-side Cons • Only accurate to the city-level • Only in the right state 85% of the time • Costly • Produces false positives Wednesday, April 1, 2009
  36. 36. IP Geolocation Vendors • MaxMind - http://www.maxmind.com • Has a free database - GeoLite City • Quova - http://www.quova.com • IPligence - http://www.ipilgence.com • IP2Location - http://www.ip2location.com Wednesday, April 1, 2009
  37. 37. Triangulation GPS 10 m Wi-Fi 20 m Cell Tower 1000 m Wednesday, April 1, 2009
  38. 38. GPS Pros • Accurate after it gets a fix • Highly accurate in rural area Cons • Doesn’t work indoors • Difficulty with Urban Canyons • Long Time to First Fix Wednesday, April 1, 2009
  39. 39. Wi-Fi Triangulation Wednesday, April 1, 2009
  40. 40. Wi-Fi Positioning (WPS) Pros • Accurate • Works indoors and in Urban Areas • Quick Time to First Fix • Software-only, leverages existing Wi-Fi Cons • Doesn’t work well in rural areas Wednesday, April 1, 2009
  41. 41. • Cross-platform, cross-browser plugin for adding geolocation to any website • Locate a user down to their exact street address with a few lines of javascript • http://loki.com/how • </plug> Wednesday, April 1, 2009
  42. 42. Cell Triangulation Pros • Works where there is cell coverage (most areas) • Quick Time to First Fix • Software-only, leverages existing cellular radio Cons • Very inaccurate Wednesday, April 1, 2009
  43. 43. short answer hyrbid is the way Wednesday, April 1, 2009
  44. 44. W3C Geolocation API ... shut up and get to the code Wednesday, April 1, 2009
  45. 45. Single shot lookup navigator.geolocation.getCurrentPosition(function(pos){ //show map at (pos.coords.latitude, pos.coords.longitude) }); Wednesday, April 1, 2009
  46. 46. Position & Coordinates Objects interface Position { readonly attribute Coordinates coords; readonly attribute DOMTimeStamp timestamp; }; interface Coordinates { readonly attribute double latitude; readonly attribute double longitude; readonly attribute double altitude; readonly attribute double accuracy; readonly attribute double altitudeAccuracy; readonly attribute double heading; readonly attribute double speed; }; Wednesday, April 1, 2009
  47. 47. Single shot lookup w/ callbacks function showMap(pos) { //show map at pos.coords.latitude, pos.coords.longitude } function showError(err) { alert(err.message + ‘, ’ + err.code); } navigator.geolocation.getCurrentPosition(showMap, showError); Wednesday, April 1, 2009
  48. 48. PositionError Object interface PositionError { const unsigned short UNKNOWN_ERROR = 0; const unsigned short PERMISSION_DENIED = 1; const unsigned short POSITION_UNAVAILABLE = 2; const unsigned short TIMEOUT = 3; readonly unsigned short code; readonly DOMString message; }; Wednesday, April 1, 2009
  49. 49. Single shot lookup w/ callbacks & options function showMap(pos) { //show map at pos.coords.latitude, pos.coords.longitude } function showError(err) { alert(err.message + ‘, ’ + err.code); } navigator.geolocation.getCurrentPosition(showMap, showError, {enableHighAccuracy:true}); Wednesday, April 1, 2009
  50. 50. PositionOptions interface PositionOptions { attribute boolean enableHighAccuracy; attribute long timeout; attribute long maximumAge; }; Wednesday, April 1, 2009
  51. 51. Single shot lookup w/ cached position function showMap(pos) { //show map at pos.coords.latitude, pos.coords.longitude } function showError(err) { alert(err.message + ‘, ’ + err.code); } navigator.geolocation.getCurrentPosition(showMap, showError, {maximumAge:300000, timeout:0}); Wednesday, April 1, 2009
  52. 52. Periodic lookup w/ callbacks function moveMap(pos) { //update map to pos.coords.latitude, pos.coords.longitude } function showError(err) { alert(err.message + ‘, ’ + err.code); } // Track location with periodic updates watchId = navigator.geolocation.watchPosition(moveMap, showError); function stopTracking() { navigator.geolocation.clearWatch(watchId); } Wednesday, April 1, 2009
  53. 53. Upcoming Geo Events • Where 2.0 San Jose, CA May 19th - 21st • WhereCamp San Francisco, CA May 23rd - 24th Wednesday, April 1, 2009
  54. 54. Questions? tweet @rsarver with questions as well Wednesday, April 1, 2009

×