GeolocationCoordinates
Baseline
Widely available
*
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2020年7月.
* Some parts of this feature may have varying levels of support.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
GeolocationCoordinates 介面表示設備在地球上的位置和高度,以及計算這些屬性的準確性。地理位置訊息是以世界大地測量系統座標(WGS84)提供的。
實例屬性
GeolocationCoordinates 介面不繼承任何屬性。
GeolocationCoordinates.latitudeRead only-
返回一個
double,表示位置的緯度(十進制度)。 GeolocationCoordinates.longitudeRead only-
返回一個
double,表示位置的經度(十進制度)。 GeolocationCoordinates.altitudeRead only-
返回一個
double,表示相對於名義海平面的高度(以公尺為單位)。如果實現無法提供數據,則此值可以為null。 GeolocationCoordinates.accuracyRead only-
返回一個
double,表示latitude和longitude屬性的準確性(以公尺為單位)。 GeolocationCoordinates.altitudeAccuracyRead only-
返回一個
double,表示高度的準確性(以公尺為單位)。如果實現無法提供數據,則此值可以為null。 GeolocationCoordinates.headingRead only-
返回一個
double,表示設備面向的方向。此值以度為單位,表示設備偏離真北的程度。0度表示真北,方向順時針確定(這意味著東是90度,西是270度)。如果speed為0或設備無法提供heading訊息,則heading為null。 GeolocationCoordinates.speedRead only-
返回一個
double,表示設備的速度(以公尺每秒為單位)。此值可以為null。
實例方法
GeolocationCoordinates 介面不繼承任何方法。
GeolocationCoordinates.toJSON()-
返回以 JSON 表示的
GeolocationCoordinates物件,並啟用使用JSON.stringify()進行序列化。
規範
| Specification |
|---|
| Geolocation> # coordinates_interface> |
瀏覽器相容性
Loading…