| Line 9... |
Line 9... |
| 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>
|
| Line 11... |
Line 11... |
| 11 |
|
11 |
|
| 12 |
<body>
|
12 |
<body>
|
| - |
|
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"
|
| 13 |
<script src="./tb-geoloc-lib-app.js"></script>
|
- |
|
| - |
|
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"
|
| 14 |
|
26 |
map_quest_api_key="mG6oU5clZHRHrOSnAV0QboFI7ahnGg34"
|
| 15 |
<form>
|
27 |
>
|
| - |
|
28 |
</tb-geolocation-element>
|
| 16 |
<div id="tb-map"></div>
|
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">
|
- |
|
| 23 |
</div>
|
35 |
<input id="altitude" type="text" placeholder="altitude">
|
| Line 24... |
Line 36... |
| 24 |
</form>
|
36 |
</form>
|
| 25 |
|
37 |
|
| 26 |
<script>
|
- |
|
| 27 |
var map = document.createElement('tb-geolocation-element');
|
- |
|
| 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);
|
38 |
<script>
|
| 43 |
|
39 |
var tbGeolocation = document.getElementById('tb-geolocation');
|
| 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;
|