Subversion Repositories eFlore/Applications.cel

Rev

Rev 3857 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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