Coordinates

Coordinates 這個介面用來存取裝置的經緯度,速度以及這些數值的準確度。

屬性

Coordinates 這個介面沒有繼承任何屬性

Coordinates.latitude Read only

回傳一個十進位的 double 代表緯度。

Coordinates.longitude Read only

回傳一個十進位的 double 代表經度。

Coordinates.altitude Read only

回傳一個 double 代表距離海平面的高度,單位為公尺。如果無法提供這個值則回傳 null。

Coordinates.accuracy Read only

回傳一個 double 代表經緯度的精準值,單位為公尺。

Coordinates.altitudeAccuracy Read only

回傳一個 double 代表高度的精準度,單位為公尺。如果無法提供這個值則回傳 null。

Coordinates.heading Read only

回傳一個 double 代表裝置前進的方向,這個數值代表你偏離北方多少度,0 度代表你向著正北方,照著順時針的方向遞增(90 度代表正東方,270 度代表正西方) 。如果速度值為 0 度,則此值為 NaN (en-US)。如果無法提供這個值則回傳 null。

Coordinates.speed Read only

回傳一個 double 代表速度,單位為公尺/秒。如果無法提供這個值則回傳 null。

方法

Coordinates 這個介面,沒有實作也沒有繼承自任何的方法。

規格

Specification
Geolocation API
# coordinates_interface

瀏覽器的相容性

BCD tables only load in the browser

請參考