Search code examples
pythongoogle-mapsgps

How to convert long/lat integers from google history JSON to google map format?


Google History JSON exporeted api return two integer for latitude and longitude, the file look like this:

{
  "locations" : [ {
    "timestampMs" : "1525631885005",
    "latitudeE7" : 511052047,
    "longitudeE7" : 207459413,
    "accuracy" : 16
  },
  ...
  ]
}

I have script that search through that JSON and I want to test if it find correct location, so how can I convert that numbers to values that can copy paste to google map web app to test?


Solution

  • latitudeE7 and longitudeE7 are the latitude and longitude multiplied by 1e7 (10^7).

    To get the latitude and longitude divide them by 1e7. That is latitude:51.1052047, longitude: 20.7459413

    That would be "Bliżyn, Poland".