Adding the elevation API in poi edit form
This commit is contained in:
@@ -229,4 +229,16 @@ form.form input[type=radio]+label img {
|
||||
}
|
||||
.leaflet-control-scale {
|
||||
opacity: 0.8 !important;
|
||||
}
|
||||
|
||||
#elevation_icon {
|
||||
font-size: 20px;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
top: 18px;
|
||||
right: 34px;
|
||||
}
|
||||
|
||||
#elevation_icon i {
|
||||
position: absolute;
|
||||
}
|
||||
@@ -36,7 +36,8 @@
|
||||
<div class="flex_line">
|
||||
<input type="text" value="<?=$poi->lat?>" name="lat" id="lat" placeholder="Latitude">
|
||||
<input type="text" value="<?=$poi->lon?>" name="lon" id="lon" placeholder="Longitude">
|
||||
<input type="text" value="<?=$poi->alt?>" name="alt" id="alt" placeholder="Altitude">
|
||||
<input type="text" value="<?=$poi->ele?>" name="ele" id="ele" placeholder="Altitude">
|
||||
<div id="elevation_icon" title="Calculer l'altitude"><i class="fas fa-search-location"></i></div>
|
||||
</div>
|
||||
|
||||
<input name="submit" id="submit" type="submit" value="Ajouter l'hébergement">
|
||||
|
||||
@@ -66,4 +66,12 @@ $( document ).ready(function() {
|
||||
poiicon.options.iconUrl = e.currentTarget.firstChild.currentSrc;
|
||||
poi_layer.setIcon(poiicon);
|
||||
})
|
||||
|
||||
$("#elevation_icon").click(function(e) {
|
||||
$(this).find($(".fas")).removeClass('fa-search-location').addClass('fa-spinner').addClass('fa-spin');
|
||||
$.get("./elevation_proxy", {location:$("#lat").val()+","+$("#lon").val()}, function(result){
|
||||
$("#ele").val(result.results[0].elevation);
|
||||
$("#elevation_icon").find($(".fas")).removeClass('fa-spinner').removeClass('fa-spin').addClass('fa-search-location');
|
||||
});
|
||||
})
|
||||
});
|
||||
Reference in New Issue
Block a user