L'image doit avoir un attribut exif="true"
Un objet global EXIF est créé. Ses méthodes:
var oImg = new Image();
oImg.onload = function() {
EXIF.getData(oImg,
function() {
var aLat = EXIF.getTag(oImg, "GPSLatitude");
var aLong = EXIF.getTag(oImg, "GPSLongitude");
if (!(aLat && aLong)) return; // no GPS info
// convert from deg/min/sec to decimal for Google
var strLatRef = EXIF.getTag(oImg, "GPSLatitudeRef") || "N";
var strLongRef = EXIF.getTag(oImg, "GPSLongitudeRef") || "W";
var fLat = (aLat[0] + aLat[1]/60 + aLat[2]/3600) * (strLatRef == "N" ? 1 : -1);
var fLong = (aLong[0] + aLong[1]/60 + aLong[2]/3600) * (strLongRef == "W" ? -1 : 1);
// center the google map and add a marker
oMap.setCenter(new GLatLng(fLat, fLong), 13);
oMarker = new GMarker(new GLatLng(fLat, fLong));
oMap.addOverlay(oMarker);
}
);
}
oImg.src = "my_gps_tagged_photo.jpg";