1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-17 05:15:20 +03:00

Add status check

This commit is contained in:
breadoven 2021-10-02 10:55:17 +01:00
parent e94317eb5b
commit 6877aea6ae
2 changed files with 13 additions and 10 deletions

View file

@ -435,6 +435,7 @@ let WaypointCollection = function () {
samples = sampleMaxNum;
}
let elevation = "N/A";
if (globalSettings.mapProviderType == 'bing') {
let elevationEarthModel = $('#elevationEarthModel').prop("checked") ? "sealevel" : "ellipsoid";
@ -456,12 +457,15 @@ let WaypointCollection = function () {
});
const response = await fetch('https://api.opentopodata.org/v1/aster30m?locations='+coordList+'&samples='+String(samples+1));
const myJson = await response.json();
var elevation = [];
for (var i = 0; i < myJson.results.length; i++){
if (myJson.results[i].elevation == null) {
elevation[i] = 0;
} else {
elevation[i] = myJson.results[i].elevation;
if (myJson.status == "OK") {
elevation = [];
for (var i = 0; i < myJson.results.length; i++){
if (myJson.results[i].elevation == null) {
elevation[i] = 0;
} else {
elevation[i] = myJson.results[i].elevation;
}
}
}
}