aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/geolocationcoordinates/index.html
blob: 7a17204abfbadfe2c1a40fe47dbbd4bf795d8302 (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
---
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>

<p>{{ CompatibilityTable() }}</p>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Chrome</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>5</td>
   <td>{{CompatGeckoDesktop("1.9.1")}}</td>
   <td>9</td>
   <td>10.60<br>
    Removed in 15.0<br>
    Reintroduced in 16.0</td>
   <td>5</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android</th>
   <th>Chrome for Android</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>IE Mobile</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatUnknown()}}</td>
   <td>{{CompatUnknown()}}</td>
   <td>{{CompatGeckoMobile("4")}}</td>
   <td>{{CompatUnknown()}}</td>
   <td>10.60</td>
   <td>{{CompatUnknown()}}</td>
  </tr>
 </tbody>
</table>
</div>

<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>