javascript - Google Maps Json to GPX -
i'm trying coordinates google timeline convert them gpx format. there exist api can extract time , location google maps timeline json out?
the json-file looks this:
{ "locations" : [{ "timestampms" : "1383767355903", "latitudee7" : 481848021, "longitudee7" : 112554011, "accuracy" : 100 }, { "timestampms" : "1383767295887", "latitudee7" : 481848003, "longitudee7" : 112554027, "accuracy" : 100 }] }
i think have coordinates in google pixels , need convert coordinate latlong.
function latlng2point(latlng, map) { var topright = map.getprojection().fromlatlngtopoint(map.getbounds().getnortheast()); var bottomleft = map.getprojection().fromlatlngtopoint(map.getbounds().getsouthwest()); var scale = math.pow(2, map.getzoom()); var worldpoint = map.getprojection().fromlatlngtopoint(latlng); return new google.maps.point((worldpoint.x - bottomleft.x) * scale, (worldpoint.y - topright.y) * scale); } function point2latlng(point, map) { var topright = map.getprojection().fromlatlngtopoint(map.getbounds().getnortheast()); var bottomleft = map.getprojection().fromlatlngtopoint(map.getbounds().getsouthwest()); var scale = math.pow(2, map.getzoom()); var worldpoint = new google.maps.point(point.x / scale + bottomleft.x, point.y / scale + topright.y); return map.getprojection().frompointtolatlng(worldpoint); }
Comments
Post a Comment