Coordinates

  • Revision slug: Web/API/Coordinates
  • Revision title: Coordinates
  • Revision id: 458285
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment

Revision Content

A Coordinates object is an arbitrary JavaScript object.

Properties

The Coordinates interface doesn't inherit any property.

{{domxref("Coordinates.latitude")}} {{readonlyInline}}
Returns a double representing the latitude of the position in decimal degrees.
{{domxref("Coordinates.longitude")}} {{readonlyInline}}
Returns a double representing the longitude of the position in decimal degrees.
{{domxref("Coordinates.altitude")}} {{readonlyInline}}
Returns a double representing the altitude of the position in meters, relative to sea level. This value can be null.
{{domxref("Coordinates.accuracy")}} {{readonlyInline}}
Returns a double representing the accuracy of the latitude and longitude properties expressed in meters.
{{domxref("Coordinates.altitudeAccuracy")}} {{readonlyInline}}
Returns a double representing the accuracy of the altitude expressed in meters. This value can be null.
{{domxref("Coordinates.heading")}} {{readonlyInline}}
Returns a double 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. 0 degrees represents true true north, and the direction is determined clockwise (which means that east is 90 degrees and west is 270 degrees). If speed is 0, heading is NaN. If the device is not able to provide heading information, this value is null.
{{domxref("Coordinates.speed")}} {{readonlyInline}}
Returns a double representing the velocity of the device in meters per second. This value can be null.

Methods

The Coordinates interface neither implements, nor inherit any method.

Specifications

Specification Status Comment
{{SpecName('Geolocation', '#coordinates', 'Coordinates')}} {{Spec2('Geolocation')}} Initial specification.

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 5 {{CompatGeckoDesktop("1.9.1")}} 9 10.60
Removed in 15.0
Reintroduced in 16.0
5
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support {{CompatUnknown()}} {{CompatUnknown()}} {{CompatGeckoMobile("4")}} {{CompatUnknown()}} 10.60 {{CompatUnknown()}}

See also

Revision Source

<p>A <strong><code>Coordinates</code></strong> object is an arbitrary JavaScript object.</p>
<h2 id="Properties">Properties</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 latitude of the position in decimal degrees.</dd>
  <dt>
    {{domxref("Coordinates.longitude")}} {{readonlyInline}}</dt>
  <dd>
    Returns a <code>double</code> representing the longitude of the position in decimal degrees.</dd>
  <dt>
    {{domxref("Coordinates.altitude")}} {{readonlyInline}}</dt>
  <dd>
    Returns a <code>double</code> representing the altitude of the position in meters, relative to sea level. This value can be <code>null</code>.</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 not able 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="Methods">Methods</h2>
<p><em><em>The <code>Coordinates</code> interface <em>neither implements, nor inherit any method.</em></em></em></p>
<h2 id="Specifications">Specifications</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="Browser_compatibility">Browser compatibility</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="See_also">See also</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>
Revert to this revision