use geodinfo() function to retrieve the terrain elevation for a coordinate
This commit is contained in:
parent
709e505f0a
commit
2e9c693e67
1 changed files with 2 additions and 18 deletions
|
@ -315,16 +315,9 @@ var _put_model = func(path, lat, lon, elev_m = nil, hdg = 0, pitch = 0, roll = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var terr_tree = nil;
|
|
||||||
var terr_lon = nil;
|
|
||||||
var terr_lat = nil;
|
|
||||||
var terr_elev = nil;
|
|
||||||
|
|
||||||
var elevation = func(lat, lon) {
|
var elevation = func(lat, lon) {
|
||||||
terr_lat.setDoubleValue(lat);
|
var d = geodinfo(lat, lon);
|
||||||
terr_lon.setDoubleValue(lon);
|
return d == nil ? nil : d[0];
|
||||||
var success = fgcommand("terrain-elevation", terr_tree);
|
|
||||||
return success ? terr_elev.getValue() : nil;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -367,15 +360,6 @@ _setlistener("/sim/signals/nasal-dir-initialized", func {
|
||||||
acos = math.acos;
|
acos = math.acos;
|
||||||
mod = math.mod;
|
mod = math.mod;
|
||||||
|
|
||||||
terr_tree = props.Node.new();
|
|
||||||
terr_lat = terr_tree.getNode("latitude-deg", 1);
|
|
||||||
terr_lon = terr_tree.getNode("longitude-deg", 1);
|
|
||||||
terr_elev = terr_tree.getNode("elevation-m", 1);
|
|
||||||
|
|
||||||
terr_lat.setDoubleValue(0.0);
|
|
||||||
terr_lon.setDoubleValue(0.0);
|
|
||||||
terr_elev.setDoubleValue(-9999.0);
|
|
||||||
|
|
||||||
aircraft_lat = props.globals.getNode("/position/latitude-deg", 1);
|
aircraft_lat = props.globals.getNode("/position/latitude-deg", 1);
|
||||||
aircraft_lon = props.globals.getNode("/position/longitude-deg", 1);
|
aircraft_lon = props.globals.getNode("/position/longitude-deg", 1);
|
||||||
aircraft_alt = props.globals.getNode("/position/altitude-ft", 1);
|
aircraft_alt = props.globals.getNode("/position/altitude-ft", 1);
|
||||||
|
|
Loading…
Add table
Reference in a new issue