Subversion Repositories eFlore/Applications.cel

Rev

Rev 3240 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3221 delphine 1
<!doctype html>
2
<html lang="">
3
 
4
<head>
5
  <base href=".">
6
  <meta charset="utf-8">
7
  <title>TB Geolocation</title>
8
  <link rel="stylesheet" href="./styles.css">
9
  <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
10
</head>
11
 
12
<body>
3260 idir 13
  <script src="./tb-geoloc-lib-app.js"></script>
14
  <tb-geolocation-element
15
    id="tb-geolocation"
16
    layer='opentopomap'
17
    zoom_init="4"
18
    lat_init="46.5"
19
    lng_init="2.9"
20
    marker="true"
21
    polyline="false"
22
    polygon="false"
23
    show_lat_lng_elevation_inputs="false"
24
    osm_class_filter=""
25
    elevation_provider="mapquest"
26
    map_quest_api_key="mG6oU5clZHRHrOSnAV0QboFI7ahnGg34"
3240 idir 27
    >
3221 delphine 28
  </tb-geolocation-element>
29
 
3260 idir 30
  <form style="display:inline-flex;flex-direction:row;margin:5px;padding:5px;justify-content:space-between;width:80%;border:2px solid grey;">
31
    <input id="locality" type="text" placeholder="locality">
32
    <input id="postcode" type="text" placeholder="postcode">
33
    <input id="latitude" type="text" placeholder="latitude">
34
    <input id="longitude" type="text" placeholder="longitude">
35
    <input id="altitude" type="text" placeholder="altitude">
36
  </form>
3240 idir 37
 
3221 delphine 38
  <script>
39
    var tbGeolocation = document.getElementById('tb-geolocation');
40
    tbGeolocation.addEventListener("location", function(location) {
3260 idir 41
      console.log(location.detail);
42
      document.getElementById('locality').value = location.detail.locality;
43
      document.getElementById('postcode').value = location.detail.osmPostcode;
44
      document.getElementById('latitude').value = location.detail.geometry.coordinates[1];
45
      document.getElementById('longitude').value = location.detail.geometry.coordinates[0];
46
      document.getElementById('altitude').value = location.detail.elevation;
3221 delphine 47
    });
48
  </script>
49
 
50
</body>
51
 
52
</html>