CARVIEW |
Select Language
HTTP/2 301
server: GitHub.com
content-type: text/html
x-origin-cache: HIT
location: https://webplatform.github.io/docs/apis/geolocation/Coordinates/
access-control-allow-origin: *
expires: Wed, 15 Oct 2025 00:38:53 GMT
cache-control: max-age=600
x-proxy-cache: MISS
x-github-request-id: FD2E:31E56F:F7D9E:127F07:68EEEAC2
accept-ranges: bytes
age: 0
date: Wed, 15 Oct 2025 00:28:53 GMT
via: 1.1 varnish
x-served-by: cache-bom-vanm7210057-BOM
x-cache: MISS
x-cache-hits: 0
x-timer: S1760488133.383641,VS0,VE282
vary: Accept-Encoding
x-fastly-request-id: f0244717d86071b31fdd219ac5d7ab1d3a2ad5b3
content-length: 162
HTTP/2 200
server: GitHub.com
content-type: text/html; charset=utf-8
last-modified: Thu, 09 Jan 2020 08:57:10 GMT
access-control-allow-origin: *
etag: W/"5e16eae6-251f"
expires: Wed, 15 Oct 2025 00:38:53 GMT
cache-control: max-age=600
content-encoding: gzip
x-proxy-cache: MISS
x-github-request-id: 27BA:DAA1D:F18AF:121966:68EEEAC4
accept-ranges: bytes
age: 0
date: Wed, 15 Oct 2025 00:28:53 GMT
via: 1.1 varnish
x-served-by: cache-bom-vanm7210057-BOM
x-cache: MISS
x-cache-hits: 0
x-timer: S1760488134.679397,VS0,VE282
vary: Accept-Encoding
x-fastly-request-id: 9c2e2717e28913ed388b8b54266d338433507066
content-length: 2925
Coordinates · WebPlatform Docs
This page is Ready to Use
Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.
Coordinates
Summary
The geographic coordinate reference system used by the attributes in this interface is the World Geodetic System (2d).
Properties
- accuracy
- Denotes the accuracy level of the latitude and longitude coordinates. It is specified in meters and must be supported by all implementations. The value of this attribute must be a non-negative real number.
- alititudeAccuracy
- Denotes the accuracy level of the altitude coordinate, specified in meters. If the implementation cannot provide altitude information, the value of this attribute must be null.
- altitude
- Denotes the height of the position, specified in meters above the ellipsoid. If the implementation cannot provide altitude information, the value of this attribute must be null.
- heading
- Denotes the direction of travel of the hosting device specified in degrees, where 0° ≤ heading < 360°, counting clockwise relative to the true north. If the implementation cannot provide heading information, the value of this attribute must be null. If the hosting device is stationary (i.e., the value of the speed attribute is 0), then the value of this attribute must be NaN.
- latitude
- Geographic latitude specified in decimal degrees.
- longitude
- Geographic longitude specified in decimal degrees.
- speed
- Denotes the magnitude of the horizontal component of the hosting device’s current velocity specified in meters per second. If the implementation cannot provide speed information, the value of this attribute must be null. Otherwise, the value of this attribute must be a non-negative real number.
Methods
No methods.
Events
No events.
Examples
Obtain user location with all available information available within to coordinates object.
navigator.geolocation.getCurrentPosition(geoSuccess,geoError);
/* Position found*/
function geoSuccess(position)
{
alert('latitude: '+position.coords.latitude+' AND longitude: '+position.coords.longitude);
/* Denotes the accuracy level of the latitude and longitude coordinates in meters */
alert(position.coords.accuracy);
/* Denotes the accuracy level of the altitude coordinate in meters */
alert(position.coords.alititudeAccuracy);
/* Denotes the height of the position, specified in meters above the ellipsoid. */
alert(position.coords.altitude);
/* Denotes the direction of travel of the hosting device specified in degrees */
alert(position.coords.heading);
/* Denotes the magnitude of the horizontal component of the hosting device's current velocity specified in meters per second. */
alert(position.coords.speed);
}
/* Position not found*/
function geoError(position)
{
alert("No position found");
}
Related specifications
- W3C Geolocation Specification
- W3C Proposed Recommendation
Attributions
This article contains content originally from external sources, including ones licensed under the CC-BY-SA license.
Portions of this content copyright 2012 Mozilla Contributors. This article contains work licensed under the Creative Commons Attribution-Sharealike License v2.5 or later. The original work is available at Mozilla Developer Network: Article
Microsoft Developer Network: Windows Internet Explorer API reference Article