navigator.geolocation.getCurrentPosition
Publicado por luis (3 intervenciones) el 04/07/2017 15:45:09
Hola Chicos :
Intento hacer que el siguiente html en vez de centar en unas posiciones concretas ( center: {lat: 34.04924594193164, lng: -118.24104309082031} )
me localice y utilice mi ubicacion para darme la posición y referencia de trafico.
Gracias de ante mano
Intento hacer que el siguiente html en vez de centar en unas posiciones concretas ( center: {lat: 34.04924594193164, lng: -118.24104309082031} )
me localice y utilice mi ubicacion para darme la posición y referencia de trafico.
Gracias de ante mano
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Traffic layer</title>
<style>
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
#map {
height: 100%;
}
/* Optional: Makes the sample page fill the window. */
html, body {
height: 100%;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
function initMap() {
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 13,
center: {lat: 34.04924594193164, lng: -118.24104309082031}
});
var trafficLayer = new google.maps.TrafficLayer();
trafficLayer.setMap(map);
}
</script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap">
</script>
</body>
</html>
Valora esta pregunta


0