Geoloaction
-
Upload
learningtech -
Category
Technology
-
view
127 -
download
0
description
Transcript of Geoloaction
GEOLOCATION APIJason
Support
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.
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
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
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.
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.
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.
Geolocation API - Method
clearWatch ( WatchID )
Stops listening for updates to the current geographical location.
Reference
http://msdn.microsoft.com/en-us/library/ie/hh772290(v=vs.85).aspx
http://kuro.tw/blog/2011/12/07/html5-geolocation-api