Hi fellow wiki editors!

To help newly registered users get more familiar with the wiki (and maybe older users too) there is now a {{Welcome to the wiki}} template. Have a look at it and feel free to add it to new users discussion pages (and perhaps your own).

I have tried to keep the template short, but meaningful. /Johan G

Howto:Get a number of elevation offsets for a number of objects

From FlightGear wiki
Jump to: navigation, search
  1. Backup your tile.
  2. Remove all needed objects from the tile.
  3. Write the name of the backup tile in the script.
  4. Save the script: $data/Nasal/objects.nas
  5. Start fgfs in a location on/near the tile.
  6. Run the script from the debug nasal console: objects.elev_get_offset()
  7. Get a brand new .stg output on your terminal with a new column showing elevation offsets at the end of each line.
  8. Save it somewhere.
  9. Restore the original tile file.
var path_file = "/home/alexis/fgfs/base/data-head/Scenery/Objects/w120n30/w118n35/1023849.stg.back";

var elev_get_offset = func {
  var raw_str = io.readfile(path_file);
  var raw_list = split("\n", raw_str);
  foreach(var l; raw_list) {
     var l_list = split(" ", l);
     if (size(l_list) == 6) {
        var terrain_elev = geo.elevation(l_list[3], l_list[2]);
        var object_elev = l_list[4];
        var offset = sprintf("%.3f", (object_elev - terrain_elev));
        print( l_list[0] ~" "~ l_list[1] ~" "~ l_list[2] ~" "~ l_list[3] ~" "~ l_list[4] ~" "~ l_list[5] ~" "~ offset);
     } else {
        print();
     }
  }
  print(size(raw_list));
}

Related content