-
Notifications
You must be signed in to change notification settings - Fork 0
/
locatie.js
24 lines (24 loc) · 996 Bytes
/
locatie.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
get_geo_position();
function on_success(position){
document.getElementById("latitude").innerHTML = "Latitude = " + position.coords.latitude;
document.getElementById("longitude").innerHTML = "Longitude= " + position.coords.longitude;
document.getElementById("acc").innerHTML = "Accuracy = "+position.coords.accuracy;
document.getElementById("altitude").innerHTML = "Altitude = "+position.coords.altitude;
var latlon = position.coords.latitude + "," + position.coords.longitude;
var img_url = "https://maps.googleapis.com/maps/api/staticmap?center="+latlon+"&zoom=14&size=400x300&key=AIzaSyAC-EEUuPWNapp4LlohSY2QZlObP7NOJ9o";
document.getElementById("map").innerHTML = "<img src='"+img_url+"'>";
}
function on_error(e)
{
document.getElementById("text").innerHTML = e.message;
}
var geo_params = {
enableHighAccuracy:true,
timeout:1000,
maximumAge:0
};
function get_geo_position()
{
var geo = navigator.geolocation;
geo.getCurrentPosition(on_success, on_error, geo_params)
}