How to convert here_2d_coordinate_diffs or cm_from_WGS84_ellipsoid_diffs into real coordinates or altitude values
Symptoms
- You see
here_2d_coordinate_diffsandcm_from_WGS84_ellipsoid_diffsin HERE HD Lanes data, but you cannot tell how to convert them into usable latitude/longitude or altitude values. - Example raw values may look like
"here_2d_coordinate_diffs": ["10247998343","461447","106248", ... ], but the numbers do not match readable coordinates by themselves. - Customers also often do not know which reference value to use, especially for
tile_center_here_3d_coordinateand its"here_2d_coordinate"field.
Quick Answer
These diffs are not real coordinates by themselves; you must reconstruct each value by applying the XOR operator (^) to the previous real value and the current diff. For here_2d_coordinate_diffs, use the tile center here_2d_coordinate as the initial reference value, and for cm_from_WGS84_ellipsoid_diffs, use 0 as the initial reference value.
Step-by-Step Resolution
- Locate the tile center reference value in the same HERE HD Lanes file. The article example shows:
"tile_center_here_3d_coordinate": { "here_2d_coordinate": "581931217788600320" }. - To reconstruct
here_2d_coordinate_diffs, use that tile centerhere_2d_coordinateas the reference value for the first calculation. - Apply XOR (
^) between the reference value and the first diff. In the example,581931217788600320 ^ 10247998343 = 581931228036598663, which gives the first real 2D coordinate value. - For the second diff and every diff after that, use the previously reconstructed real value as the new reference. In the example,
581931228036598663 ^ 461447 = 581931228036530432. - Repeat this logic for the full list to reconstruct all real 2D coordinate values. The example article shows the resulting sequence as
[581931228036598663, 581931228036530432, 581931228036505096, 581931228036866582, 581931228036900868, 581931228037003571, 581931228037097472, 581931228038701626, 581931228038804646]. - To reconstruct
cm_from_WGS84_ellipsoid_diffs, use0as the initial reference value. The first altitude example is0 ^ 74456 = 74456.
7. For the next altitude value, use the previous reconstructed altitude as the new reference. The example shows74456 ^ 13 = 74453. - Continue the same XOR process through the remaining altitude diffs to reconstruct the full altitude list in centimeters. The example article gives
[74456, 74453, 74455, 74462, 74475, 74494, 74520, 74552, 74592]. - The article states that the XOR operator is
^in programming languages such as C, Java, and Python, so you can implement the reconstruction logic directly in code.
Verification
- Confirm that the first reconstructed 2D coordinate matches the expected example value
581931228036598663when using the tile center reference and the first diff. - Confirm that the second reconstructed 2D coordinate matches
581931228036530432when using the first reconstructed value and the second diff. - Confirm that the altitude sequence begins with
74456and then74453when reconstructed from0and the first two altitude diffs. - A common mistake is using the tile center value for every 2D diff instead of only for the first one; after that, each new calculation must use the previous reconstructed value.
- Another common mistake is using the tile center as the initial reference for altitude; the article explicitly says altitude reconstruction starts from
0.
Updated 14 days ago
Did this page help you?