W 3C Geolocation API Michael ( tm ) Smith mike@w3 . org Overview - - PowerPoint PPT Presentation

w 3c geolocation api
SMART_READER_LITE
LIVE PREVIEW

W 3C Geolocation API Michael ( tm ) Smith mike@w3 . org Overview - - PowerPoint PPT Presentation

W 3C Geolocation API Michael ( tm ) Smith mike@w3 . org Overview API for use in W eb applications ( through JavaScript binding ) enables Web application running on a remote server to access user location ( latitude / longitude ) data ; e


slide-1
SLIDE 1

W 3C Geolocation API

Michael(tm) Smith mike@w3.org

slide-2
SLIDE 2

Overview

  • API for use in W eb applications

(through JavaScript binding)

  • enables Web application running on a

remote server to access user location (latitude/longitude) data; e.g., for a user accessing the Web from a browser running on a mobile device (mobile handset, laptop, etc.)

slide-3
SLIDE 3

How does a W eb app get access to user location data?

The API requires browser support ; either the device a browser is running on must directly expose one or more location- sensing mechanisms (e.g., GPS) to the browser, or some other third- party application must expose it to the browser (e.g., WiFi positioning through SkyHook)

slide-4
SLIDE 4

W ho’ s doing the work?

  • W3C Geolocation Working Group
  • the editor for the spec works for

Google

  • Google Gears has already shipped

with support for the API

slide-5
SLIDE 5

W here to get it

http://dev.w3.org/geo/api/spec- source.html

slide-6
SLIDE 6

Requirem ents

  • must provide location data in terms of

a pair of latitude and longitude coordinates

  • must provide information about the

accuracy of the retrieved location data

  • must support "
  • ne-

shot" position updates

slide-7
SLIDE 7

Requirem ents (m ore)

  • must allow an application to register

to receive repeated position updates

  • must allow an application to cheaply

query the last known position

  • must provide a way for the application

to receive updates about errors that may have occurred while obtaining a location fix

slide-8
SLIDE 8

Requirem ents (m ore)

  • must allow an application to specify a

desired accuracy level of the location information

  • must be agnostic to the underlying

sources of location inform ation

  • should allow an application to request

address information as part of the location data

slide-9
SLIDE 9

Agnostic about location m ethod

  • The API does not expect or depend on

any particular location method.

  • Can work with any location-

sensing m echanism exposed to the browser; might be on GPS, IP address, RFID, WiFi, Bluetooth MAC address, GSM/ CDMA cell IDs,…

slide-10
SLIDE 10

Som e use cases

  • Show the user's position on a map
  • Find points of interest in the user's

area

  • Turn-

by- turn route navigation (like NaviTim e)

  • Push alerts when points of interest are

in the user's vicinity

  • Location-

tagged status updates in social networking applications

slide-11
SLIDE 11

Exam ple: “ One- shot” query

function showMap(position) { // Show a map centered at // at (position.latitude, position.longitude). } // One- shot position request. navi gat or .geol ocat i on.get Cur r ent Posi t i on(showMap);

slide-12
SLIDE 12

Exam ple: Position updates

function scrollMap(position) { // Scrolls the map so it is centered // at (position.latitude, position.longitude). } // Request repeated updates. var watchId = navi gat or .geol ocat i on.w at chPosi t i on(scrollMap); function buttonClickHandler() { // Cancel when user clicks button navi gat or .geol ocat i on.cl ear W at ch(watchId); }

slide-13
SLIDE 13

IDL: Geolocation interface

interface G eol ocat i on { readonly attribute Position l ast Posi t i on; void getCurrentPosition(in Posi t i onCal l back successCallback); … int watchPosition(in Posi t i onCal l back successCallback); … void clearWatch(in int watchId); };

slide-14
SLIDE 14

IDL: PositionCallback interface

interface Posi t i onCal l back { void handleEvent(in Posi t i on position); };

slide-15
SLIDE 15

IDL: Position object

interface Posi t i on { readonly attribute double l at i t ude; readonly attribute double l ongi t ude; readonly attribute double accur acy; readonly attribute double altitude; readonly attribute double altitudeAccuracy; readonly attribute double heading readonly attribute double velocity readonly attribute DOMTimeStamp timestamp; };

slide-16
SLIDE 16

The End

Thanks! mike@w3.org