blob: 42bf85e450be89a9fa9968dc4f2f5422e058bf49 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
---
title: Coordinates
slug: Web/API/GeolocationCoordinates
tags:
- API
- Geolocation API
translation_of: Web/API/GeolocationCoordinates
---
<div>{{APIRef("Geolocation API")}}</div>
<p><strong><code>Coordinates</code></strong> (坐标)接口表示设备在地球上的位置和海拔,以及计算这些属性的精确度。</p>
<h2 id="属性">属性</h2>
<p><em>The <code>Coordinates</code> interface </em><em><em>doesn't inherit any property</em></em>.</p>
<dl>
<dt>{{domxref("Coordinates.latitude")}} {{readonlyInline}}</dt>
<dd>Returns a <code>double</code> representing the position's latitude in decimal degrees.</dd>
<dt>{{domxref("Coordinates.longitude")}} {{readonlyInline}}</dt>
<dd>Returns a <code>double</code> representing the position's longitude in decimal degrees.</dd>
<dt>{{domxref("Coordinates.altitude")}} {{readonlyInline}}</dt>
<dd>Returns a <code>double</code> representing the position's altitude in metres, relative to sea level. This value can be <code>null</code> if the implementation cannot provide the data.</dd>
<dt>{{domxref("Coordinates.accuracy")}} {{readonlyInline}}</dt>
<dd>Returns a <code>double</code> representing the accuracy of the <code>latitude</code> and <code>longitude</code> properties, expressed in meters.</dd>
<dt>{{domxref("Coordinates.altitudeAccuracy")}} {{readonlyInline}}</dt>
<dd>Returns a <code>double</code> representing the accuracy of the <code>altitude</code> expressed in meters. This value can be <code>null</code>.</dd>
<dt>{{domxref("Coordinates.heading")}} {{readonlyInline}}</dt>
<dd>Returns a <code>double</code> representing the direction in which the device is traveling. This value, specified in degrees, indicates how far off from heading due north the device is. <code>0</code> degrees represents true true north, and the direction is determined clockwise (which means that east is <code>90</code> degrees and west is <code>270</code> degrees). If <code>speed</code> is <code>0</code>, <code>heading</code> is <code><a href="/en-US/docs/JavaScript/Reference/Global_Objects/NaN" title="/en-US/docs/JavaScript/Reference/Global_Objects/NaN">NaN</a></code>. If the device is unable to provide <code>heading</code> information, this value is <code>null</code>.</dd>
<dt>{{domxref("Coordinates.speed")}} {{readonlyInline}}</dt>
<dd>Returns a <code>double</code> representing the velocity of the device in meters per second. This value can be <code>null</code>.</dd>
</dl>
<h2 id="方法">方法</h2>
<p><em><em>The <code>Coordinates</code> interface <em>neither implements, nor inherits any method.</em></em></em></p>
<h2 id="规范">规范</h2>
<table class="standard-table">
<thead>
<tr>
<th scope="col">Specification</th>
<th scope="col">Status</th>
<th scope="col">Comment</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{SpecName('Geolocation', '#coordinates', 'Coordinates')}}</td>
<td>{{Spec2('Geolocation')}}</td>
<td>Initial specification.</td>
</tr>
</tbody>
</table>
<h2 id="浏览器兼容性">浏览器兼容性</h2>
{{Compat("api.GeolocationCoordinates")}}
<h2 id="请参见">请参见</h2>
<ul>
<li><a href="/en-US/docs/WebAPI/Using_geolocation" title="/en-US/docs/WebAPI/Using_geolocation">Using geolocation</a></li>
<li>The {{domxref("Geolocation")}} interface that uses it.</li>
</ul>
|