10
GEOLOCATION API Jason

Geoloaction

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Geoloaction

GEOLOCATION APIJason

Page 2: Geoloaction

Support

Page 3: Geoloaction

Geolocation API

The Geolocation API exposes the latitude and longitude to JavaScript in a webpage by using the geolocation object, which is a child object of the window.navigator.

Page 4: Geoloaction

Geolocation API - Method getCurrentPosition(successCallback,

[errorCallback],

[options])

The function specified by thesuccessCallback parameter takes one position parameter.

The function specified by theerrorCallback parameter takes one positionError parameter

Page 5: Geoloaction

Geolocation API - Geoposition

Position Properties

Coords Properties

Explain

coords

latitude The latitude of the location specified in the coordinates object

longitude The longitude of the location specified in the coordinates object

altitude Specifies the altitude, in meters, of the coordinates object.

accuracy Gets the accuracy of the latitude and longitude  properties , in meters.

altitudeAccuracy Accuracy of the altitude  property, in meters.

heading Specifies a direction of travel

speed Current ground speed of the device running Internet Explorer, specified in meters per second.

timestamp Gets the time associated with the geographic information

Page 6: Geoloaction

Geolocation API - PositionError 

Properties Explain

code Error Code

UNKNOWN_ERROR Uncertainty Error

PERMISSION_DENIED The user has denied permission for the website to access geographic information.

POSITION_UNAVAILABLE The geographic location could not be determined.

TIMEOUT The request did not complete within the time allowed.

message Gets an error message for debugging purposes.

Page 7: Geoloaction

Geolocation API - Option

Properties Explain

enableHighAccuracy bool (false) Obtain the most accurate position possible, or false to optimize in favor of performance and power consumption.

timeout Integer (none) An Integer value that indicates the time, in milliseconds, allowed for obtaining the position.

maximumAge Integer (0) An Integer value indicating the maximum age, in milliseconds, of cached position information.

Page 8: Geoloaction

Geolocation API - Method

watchPosition(successCallback,

[errorCallback],

[options])

Returns :WatchID [Integer]

Begins listening for updates to the current geographical location of the device running the client.

Page 9: Geoloaction

Geolocation API - Method

clearWatch ( WatchID ) 

Stops listening for updates to the current geographical location.