I want to tag camera photos with geolocation (coordinates are fine). Here's a piece of my code:
function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition, showError);
} else {
x.innerHTML = "Geolocation is not supported by this browser.";
}
}
function showPosition(position) {
return position.coords.latitude + " " + position.coords.longitude;
}
and inside the method takePhoto() I have:
...
context.drawImage(video, 0, 0, 640, 480);
var loc = getLocation();
context.strokeText(loc, 10, 50);
...
My problem is that I don't know how to pass a variable that holds the location coordinates, I've tried many things but without success. Anybody any ideas?
Thanks.
