Skip to content

Commit 22ed7a4

Browse files
marcoscaceresjyasskinreillyeon
authored
Correction: Update acquisition algorithm to define data types and handle cached positions (#153)
* Correction: Update acquisition algorithm to define data types and handle cached positions Enhance the "Acquire a Position" algorithm to include explicit data type definitions and unit specifications for each piece of acquired position data, aligning with the [[WGS84]] coordinate system standards. This update ensures each parameter (latitude, longitude, altitude, etc.) is clearly defined at the point of data acquisition. Additionally, refine the handling of cached position data within the algorithm. Introduce conditional logic to terminate the algorithm early if a valid cached position is used, preventing unnecessary data acquisition steps. This change improves efficiency and clarity in the geolocation process, ensuring that position data is handled correctly based on its freshness and accuracy requirements. Key Changes: - Define explicit data types and units for latitude, longitude, altitude, accuracy, altitude accuracy, speed, and heading. - Implement conditional checks to skip unnecessary acquisition steps when using cached positions. - Update parameters passed to the `GeolocationPosition` constructor to include all newly defined data points. * Rewrite and use map * small fixes * Update index.html Co-authored-by: Jeffrey Yasskin <[email protected]> * Update index.html Co-authored-by: Jeffrey Yasskin <[email protected]> * Update index.html Co-authored-by: Jeffrey Yasskin <[email protected]> * use dl/dt/dd * fixup * Update index.html Co-authored-by: Reilly Grant <[email protected]> * Apply suggestions from code review Co-authored-by: Reilly Grant <[email protected]> --------- Co-authored-by: Jeffrey Yasskin <[email protected]> Co-authored-by: Reilly Grant <[email protected]>
1 parent 1360745 commit 22ed7a4

File tree

1 file changed

+155
-59
lines changed

1 file changed

+155
-59
lines changed

index.html

+155-59
Original file line numberDiff line numberDiff line change
@@ -834,12 +834,28 @@ <h2>
834834
value of the |options|.{{PositionOptions/maximumAge}}
835835
member.
836836
</li>
837-
<li>If |cachedPosition|'s
838-
{{GeolocationPosition/timestamp}}'s value is greater than
839-
|cacheTime|, and
840-
|cachedPosition|.{{GeolocationPosition/[[isHighAccuracy]]}}
841-
equals |options|.{{PositionOptions/enableHighAccuracy}},
842-
set |position| to |cachedPosition|.
837+
<li>
838+
<aside class="correction" id="c8">
839+
<span class="marker">Candidate Correction:</span>
840+
Updated to ensure that the algorithm terminates
841+
immediately if a valid cached position is used,
842+
avoiding unnecessary steps.
843+
</aside>If |cachedPosition|'s
844+
{{GeolocationPosition/timestamp}}'s value is greater
845+
than |cacheTime|, and
846+
|cachedPosition|.{{GeolocationPosition/[[isHighAccuracy]]}}
847+
equals
848+
|options|.{{PositionOptions/enableHighAccuracy}}<del cite="#c8">,
849+
set |position| to |cachedPosition|.</del> <ins cite=
850+
"#c8">:
851+
<ol>
852+
<li>[=Queue a task=] on the [=geolocation task
853+
source=] with a step that [=invokes=]
854+
|successCallback| with |cachedPosition|.
855+
</li>
856+
<li>Terminate this algorithm.
857+
</li>
858+
</ol></ins>
843859
</li>
844860
</ol>
845861
</li>
@@ -861,16 +877,98 @@ <h2>
861877
</li>
862878
</ol>
863879
</li>
864-
<li>If acquiring the position data from the system succeeds:
880+
<li data-cite="infra">If acquiring the position data from the
881+
system succeeds:
882+
<aside class="correction" id="c9">
883+
<span class="marker">Candidate Correction:</span> We now
884+
use a [=map=] to represent the position data. Clarified
885+
the units and reference systems for latitude, longitude,
886+
and altitude, ensuring consistency with the updated
887+
attribute definitions. Updated the descriptions of the
888+
speed and heading to specify measurement units and
889+
conditions for null values, aligning with the overall
890+
enhancements to attribute accuracy and clarity.
891+
</aside><ins cite="#c9">
892+
<ol data-cite="infra">
893+
<li>Let |positionData| be a [=map=] with the following
894+
name/value pairs based on the acquired position data:
895+
<dl>
896+
<dt>
897+
"longitude"
898+
</dt>
899+
<dd>
900+
A {{double}} that represents the longitude
901+
coordinates on the Earth's surface in degrees,
902+
using the [[WGS84]] coordinate system. Longitude
903+
measures how far east or west a point is from the
904+
Prime Meridian.
905+
</dd>
906+
<dt>
907+
"altitude"
908+
</dt>
909+
<dd>
910+
A {{double?}} that represents the altitude in
911+
meters above the [[WGS84]] ellipsoid, or `null` if
912+
not available. Altitude measures the height above
913+
sea level.
914+
</dd>
915+
<dt>
916+
"accuracy"
917+
</dt>
918+
<dd>
919+
A non-negative {{double}} that represents the
920+
accuracy value indicating the 95% confidence level
921+
in meters. Accuracy measures how close the measured
922+
coordinates are to the true position.
923+
</dd>
924+
<dt>
925+
"altitudeAccuracy"
926+
</dt>
927+
<dd>
928+
A non-negative {{double?}} that represents the
929+
altitude accuracy, or `null` if not available,
930+
indicating the 95% confidence level in meters.
931+
Altitude accuracy measures how close the measured
932+
altitude is to the true altitude.
933+
</dd>
934+
<dt>
935+
"speed"
936+
</dt>
937+
<dd>
938+
A non-negative {{double?}} that represents the
939+
speed in meters per second, or `null` if not
940+
available. Speed measures how fast the device is
941+
moving.
942+
</dd>
943+
<dt>
944+
"heading"
945+
</dt>
946+
<dd>
947+
A {{double?}} that represents the heading in
948+
degrees, or `null` if not available, or `NaN` if
949+
the device is stationary. Heading measures the
950+
direction in which the device is moving relative to
951+
true north.
952+
</dd>
953+
</dl>
954+
</li>
955+
<li>Set |position| to [=a new `GeolocationPosition`=]
956+
passing |positionData|, |acquisitionTime| and
957+
|options|.{{PositionOptions/enableHighAccuracy}}.
958+
</li>
959+
<li>Set [=this=]'s {{Geolocation/[[cachedPosition]]}} to
960+
|position|.
961+
</li>
962+
</ol></ins> <del cite="#c9">
865963
<ol>
866-
<li>Set |position| be [=a new `GeolocationPosition`=]
964+
<li>Set |position| to [=a new `GeolocationPosition`=]
867965
passing |acquisitionTime| and
868966
|options|.{{PositionOptions/enableHighAccuracy}}.
869967
</li>
870968
<li>Set [=this=]'s {{Geolocation/[[cachedPosition]]}} to
871969
|position|.
872970
</li>
873-
</ol>
971+
</ol></del>
874972
</li>
875973
<li>Stop the |timeout|.
876974
</li>
@@ -1201,82 +1299,80 @@ <h4>
12011299
representation of the {{GeolocationCoordinates}} object.</ins>
12021300
</p>
12031301
</section>
1204-
<section>
1302+
<section data-cite="infra">
12051303
<h2>
12061304
Constructing a `GeolocationPosition`
12071305
</h2>
1306+
<aside class="correction" id="c4">
1307+
<span class="marker">Candidate Correction:</span> Constructor now
1308+
takes a [=map=] of position data, a timestamp, and a boolean
1309+
indicating high accuracy as arguments. We iterate over the map to set
1310+
the attributes of the {{GeolocationCoordinates}}.
1311+
</aside>
1312+
<ins cite="#c4"><p>
1313+
<dfn>A new `GeolocationPosition`</dfn> is constructed with [=map=]
1314+
|positionData|, {{EpochTimeStamp}} |timestamp:EpochTimeStamp| and
1315+
boolean |isHighAccuracy| by performing the following steps:
1316+
</p>
1317+
<ol class="algorithm">
1318+
<li>Let |coords:GeolocationCoordinates| be a newly created
1319+
{{GeolocationCoordinates}} instance.
1320+
</li>
1321+
<li>[=map/For each=] |key| → |value| in |positionData|:
1322+
<ol>
1323+
<li>Set |coords|'s attribute named |key| to |value|.
1324+
</li>
1325+
</ol>
1326+
</li>
1327+
<li>Return a newly created {{GeolocationPosition}} instance with its
1328+
{{GeolocationPosition/coords}} attribute initialized to |coords| and
1329+
{{GeolocationPosition/timestamp}} attribute initialized to
1330+
|timestamp|, and its {{GeolocationPosition/[[isHighAccuracy]]}}
1331+
internal slot set to |isHighAccuracy|.
1332+
</li>
1333+
</ol></ins> <del cite="#c4">
12081334
<p>
1209-
<dfn>A new `GeolocationPosition`</dfn> is constructed with
1335+
<strong>A new `GeolocationPosition`</strong> is constructed with
12101336
{{EpochTimeStamp}} |timestamp:EpochTimeStamp| and boolean
12111337
|isHighAccuracy| by performing the following steps:
12121338
</p>
1213-
<aside class="correction" id="c4">
1214-
<span class="marker">Candidate Correction:</span> Enhanced the
1215-
constructor steps for {{GeolocationCoordinates}} to clarify the units
1216-
and reference systems for latitude, longitude, and altitude, ensuring
1217-
consistency with the updated attribute definitions.
1218-
</aside>
1219-
<aside class="correction" id="c5">
1220-
<span class="marker">Candidate Correction:</span> Updates to the
1221-
descriptions of the speed and heading attributes to specify
1222-
measurement units and conditions for null values, aligning with the
1223-
overall enhancements to attribute accuracy and clarity.
1224-
</aside>
12251339
<ol class="algorithm">
12261340
<li>Let |coords:GeolocationCoordinates| be a newly created
12271341
{{GeolocationCoordinates}} instance:
12281342
<ol>
12291343
<li>Initialize |coord|'s {{GeolocationCoordinates/latitude}}
1230-
<del cite="#c4">attribute to a geographic coordinate in decimal
1231-
degrees.</del> <ins cite="#c4">attribute to a latitude, specified
1232-
as a real number of degrees, in the [[WGS84]] coordinate
1233-
system.</ins>
1344+
attribute to a geographic coordinate in decimal degrees.
12341345
</li>
12351346
<li>Initialize |coord|'s {{GeolocationCoordinates/longitude}}
1236-
<del cite="#c4">attribute to a geographic coordinate in decimal
1237-
degrees.</del> <ins cite="#c4">attribute to a longitude,
1238-
specified as a real number of degrees, in the [[WGS84]]
1239-
coordinate system.</ins>
1240-
</li>
1241-
<li>Initialize |coord|'s {{GeolocationCoordinates/altitude}}
1242-
<del cite="#c4">attribute in meters above the [[WGS84]]
1243-
ellipsoid, or `null` if the implementation cannot provide
1244-
altitude information.</del> <ins cite="#c4">attribute to a
1245-
height, in meters, above the [[WGS84]] ellipsoid, or `null` if
1246-
the implementation cannot provide altitude information.</ins>
1247-
</li>
1248-
<li>Initialize |coord|'s {{GeolocationCoordinates/speed}}
1249-
<del cite="#c5">attribute to a non-negative real number, or as
1250-
`null` if the implementation cannot provide speed
1251-
information.</del> <ins cite="#c5">attribute to a speed, as a
1252-
non-negative real number of meters per second, or as `null` if
1253-
the implementation cannot provide speed information.</ins>
1254-
</li>
1255-
<li>Initialize |coord|'s {{GeolocationCoordinates/heading}}
1256-
<del cite="#c5">attribute in degrees, or `null` if the
1257-
implementation cannot provide heading information. If the hosting
1258-
device is stationary (i.e., the value of the
1259-
{{GeolocationCoordinates/speed}} attribute is 0), then initialize
1260-
the {{GeolocationCoordinates/heading}} to `NaN`.</del>
1261-
<ins cite="#c5">attribute to a heading, in degrees, or `null`
1262-
if the implementation cannot provide heading information. If
1263-
the hosting device is stationary (i.e., the value of the
1264-
{{GeolocationCoordinates/speed}} attribute is 0), then
1265-
initialize the {{GeolocationCoordinates/heading}} to
1266-
`NaN`.</ins>
1347+
attribute to a geographic coordinate in decimal degrees.
12671348
</li>
12681349
<li>Initialize |coord|'s {{GeolocationCoordinates/accuracy}}
12691350
attribute to a non-negative real number. The value SHOULD
12701351
correspond to a 95% confidence level with respect to the
12711352
longitude and latitude values.
12721353
</li>
1354+
<li>Initialize |coord|'s {{GeolocationCoordinates/altitude}}
1355+
attribute in meters above the [[WGS84]] ellipsoid, or `null` if
1356+
the implementation cannot provide altitude information.
1357+
</li>
12731358
<li>Initialize |coord|'s
12741359
{{GeolocationCoordinates/altitudeAccuracy}} attribute as
12751360
non-negative real number, or to `null` if the implementation
12761361
cannot provide altitude information. If the altitude accuracy
12771362
information is provided, it SHOULD correspond to a 95% confidence
12781363
level.
12791364
</li>
1365+
<li>Initialize |coord|'s {{GeolocationCoordinates/speed}}
1366+
attribute to a non-negative real number, or as `null` if the
1367+
implementation cannot provide speed information.
1368+
</li>
1369+
<li>Initialize |coord|'s {{GeolocationCoordinates/heading}}
1370+
attribute in degrees, or `null` if the implementation cannot
1371+
provide heading information. If the hosting device is stationary
1372+
(i.e., the value of the {{GeolocationCoordinates/speed}}
1373+
attribute is 0), then initialize the
1374+
{{GeolocationCoordinates/heading}} to `NaN`.
1375+
</li>
12801376
</ol>
12811377
</li>
12821378
<li>Return a newly created {{GeolocationPosition}} instance with its
@@ -1285,7 +1381,7 @@ <h2>
12851381
|timestamp|, and its {{GeolocationPosition/[[isHighAccuracy]]}}
12861382
internal slot set to |isHighAccuracy|.
12871383
</li>
1288-
</ol>
1384+
</ol></del>
12891385
</section>
12901386
</section>
12911387
<section id="position_error_interface" data-dfn-for=

0 commit comments

Comments
 (0)