jsongoogle-apilocationprivacygoogle-location-services

Bug with Longitude in JSON & KMLGoogle "Takeout" Location data


Location History data (downloaded from Google Takeout) is reporting incorrect Longitude on both the JSON and KML exports. Latitude is correct but Longitude is showing in the 304 to 305 range (after dividing by 107), instead of the negative number it should be in my case. It seems like the longitude data is simply "too high", by 430 (×107).

The problem shows in a JSON Location History I retrieved a few days ago; today I tried re-generating the downloads in both JSON and KML and both are still affected by this issue.

The same problem is reported by someone else here about 4 days ago but that's the only other mention of this issue I can find online.

Thoughts on how to proceed?


Solution

  • Found a solution: (no thanks to Google on this one!)

    They seem to have an integer overflow error in preparing the data for the takeout (downloading the kml directly from google maps for a specific day works correct).

    If the number is greater than 1800000000 (for latitude, also comparing to 900000000 would work) you need to subtract 2^32 (=4294967296) and you get the correct latitudeE7 or longitudeE7.

    Example:

      latitudeE7 = 4233738877 - 4294967296 = -61228419 (= 6.12 South)
      longitudeE7 = 1066510714 (= 106.7 East, no conversion here)