-
-
Save coltonbarry/a47c154c7086e28c57e2abf092a88277 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (navigator.geolocation) { | |
navigator.geolocation.getCurrentPosition(function(position){ | |
var latitude = position.coords.latitude; | |
var longitude = position.coords.longitude; | |
var accuracy = position.coords.accuracy; console.log(latitude, longitude, accuracy); /* | |
var coords = new google.maps.LatLng(latitude, longitude); | |
var mapOptions = { | |
zoom: 15, | |
center: coords, | |
mapTypeControl: true, | |
navigationControlOptions: { | |
style: google.maps.NavigationControlStyle.SMALL | |
}, | |
mapTypeId: google.maps.MapTypeId.ROADMAP | |
}; | |
var capa = document.getElementById("capa"); | |
capa.innerHTML = "latitud: " + latitude + " longitud: " + " aquesta es la precisio en metres : " + accuracy; | |
map = new google.maps.Map( | |
document.getElementById("mapContainer"), mapOptions | |
); | |
var marker = new google.maps.Marker({ | |
position: coords, | |
map: map, | |
title: "ok" | |
}); | |
*/ | |
},function error(msg){alert('Please enable your GPS position future.'); | |
}, {maximumAge:600000, timeout:5000, enableHighAccuracy: true}); | |
}else { | |
alert("Geolocation API is not supported in your browser."); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment