Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 3811 → Rev 3812

/trunk/widget/modules/manager/squelettes/js/tb-geoloc/index.html
11,33 → 11,37
 
<body>
<script src="./tb-geoloc-lib-app.js"></script>
<tb-geolocation-element
id="tb-geolocation"
layer='opentopomap'
zoom_init="4"
lat_init="46.5"
lng_init="2.9"
marker="true"
polyline="false"
polygon="false"
show_lat_lng_elevation_inputs="false"
osm_class_filter=""
elevation_provider="mapquest"
map_quest_api_key="mG6oU5clZHRHrOSnAV0QboFI7ahnGg34"
>
</tb-geolocation-element>
<form style="display:inline-flex;flex-direction:row;margin:5px;padding:5px;justify-content:space-between;width:80%;border:2px solid grey;">
<input id="locality" type="text" placeholder="locality">
<input id="postcode" type="text" placeholder="postcode">
<input id="latitude" type="text" placeholder="latitude">
<input id="longitude" type="text" placeholder="longitude">
<input id="altitude" type="text" placeholder="altitude">
 
<form>
<div id="tb-map"></div>
<div style="display:inline-flex;flex-direction:row;margin:5px;padding:5px;justify-content:space-between;width:80%;border:2px solid grey;">
<input id="locality" type="text" placeholder="locality">
<input id="postcode" type="text" placeholder="postcode">
<input id="latitude" type="text" placeholder="latitude">
<input id="longitude" type="text" placeholder="longitude">
<input id="altitude" type="text" placeholder="altitude">
</div>
</form>
<script>
var tbGeolocation = document.getElementById('tb-geolocation');
tbGeolocation.addEventListener("location", function(location) {
var map = document.createElement('tb-geolocation-element');
 
map.setAttribute('zoom_init', 8);
map.setAttribute('lat_init', 43.6);
map.setAttribute('lng_init', 3.8);
map.setAttribute('marker', true);
map.setAttribute('polyline', true);
map.setAttribute('polygon', false);
map.setAttribute('show_lat_lng_elevation_inputs', true);
map.setAttribute('osm_class_filter', '');
map.setAttribute('geometry_filter', ['linestring']);
map.setAttribute('elevation_provider', 'mapquest');
map.setAttribute('map_quest_api_key', 'mG6oU5clZHRHrOSnAV0QboFI7ahnGg34');
map.setAttribute('height', '400px');
document.getElementById('tb-map').append(map);
 
map.addEventListener("location", function(location) {
console.log(location.detail);
document.getElementById('locality').value = location.detail.locality;
document.getElementById('postcode').value = location.detail.osmPostcode;