Board index FlightGear Development Scenery

Desperately need ground elevation information!

Questions and discussion about enhancing and populating the FlightGear world.

Desperately need ground elevation information!

Postby prasenjit » Wed Sep 17, 2008 9:38 pm

Hey,

I am pretty new to Flightgear developlment. I was wondering whether there was a function or variable that can tell me the current elevation of the ground (distance from sea level) WITHOUT taking into account the building heights. I just want the raw ground elevation. I used the function get_elevation_m from the Scenery class but that takes building heights into account. Any help will be appreciated
prasenjit
 
Posts: 2
Joined: Wed Sep 17, 2008 9:32 pm

Re: Desperately need ground elevation information!

Postby prasenjit » Wed Sep 17, 2008 9:39 pm

I have the latitude longitude information, however current plane location height is perfectly fine.
prasenjit
 
Posts: 2
Joined: Wed Sep 17, 2008 9:32 pm

Re: Desperately need ground elevation information!

Postby martin » Wed Sep 17, 2008 10:06 pm

prasenjit wrote:I am pretty new to Flightgear developlment. I was wondering whether there was a function or variable that can tell me the current elevation of the ground (distance from sea level) WITHOUT taking into account the building heights. I just want the raw ground elevation. I used the function get_elevation_m from the Scenery class but that takes building heights into account. Any help will be appreciated


Aside from the fact that this has nothing to do with "Scenery Enhancement" (read the topic of this board), you're hitting a 'feature' of FlightGear here.
In order to allow aircraft to land on bridges or helicopters on top of buildings, the respective surface is being counted in when reading the current gound elevation at a given position.

To get the raw terrain elevation, point ${FG_SCENERY} to a directory that contains the "Terrain" only,

Martin.
martin
 
Posts: 666
Joined: Thu Feb 15, 2007 9:03 am
Location: EDLN

Re: Desperately need ground elevation information!

Postby zakalawe » Thu Sep 18, 2008 8:13 am

To follow up from what Martin said, elevation testing is implemented as a ray-trace with the current scene. As far as I know, there's no way to exclude objects from that test, though it's probably possibly to add this via some C++ hacking - setting a flag on objects when they're loaded, and updating the intersection code to check the flag when considering hits.

Anyway, such questions should be addressed to the developer's list, I think.
zakalawe
 
Posts: 1152
Joined: Sat Jul 19, 2008 4:48 pm
Location: Edinburgh, Scotland
Callsign: G-ZKLW
Version: next
OS: Mac

Re: Desperately need ground elevation information!

Postby AndersG » Thu Sep 18, 2008 9:34 am

zakalawe wrote:To follow up from what Martin said, elevation testing is implemented as a ray-trace with the current scene. As far as I know, there's no way to exclude objects from that test, though it's probably possibly to add this via some C++ hacking - setting a flag on objects when they're loaded, and updating the intersection code to check the flag when considering hits.


AFAIK load-time solid/non-solid selection for models is done with the <enable-hot type="boolean">false/true</enable-hot> as option described in Docs/model-howto.html.
But of course, that doesn't help if one only want to disregard the object in some elevation queries.

/Anders
Callsign: SE-AG
Aircraft (uhm...): Submarine Scout, Zeppelin NT, ZF Navy free balloon, Nordstern, Hindenburg, Short Empire flying-boat, ZNP-K, North Sea class, MTB T21 class, U.S.S. Monitor, MFI-9B, Type UB I submarine, Gokstad ship, Renault FT.
AndersG
 
Posts: 2448
Joined: Wed Nov 29, 2006 9:20 am
Location: Göteborg, Sweden
Callsign: SE-AG
OS: Debian GNU Linux

Re: Desperately need ground elevation information!

Postby statto » Thu Sep 18, 2008 4:17 pm

Would removing all objects from the terrain work with that solution?
Custom Scenery available from http://www.stattosoftware.com/flightgear
statto
 
Posts: 2112
Joined: Fri Jan 25, 2008 9:57 pm

Re: Desperately need ground elevation information!

Postby Jester » Fri Sep 19, 2008 1:27 pm

However, you can enumerate the layers and maybe detect the "real" ground by material type (which is what I have done for the towers). Note, I don't think picking the lowest layer works because some buildings are sunk into the ground.
Jester
 
Posts: 1200
Joined: Wed Feb 28, 2007 3:53 pm
Location: Hungary
Callsign: BA996,Rescue1
IRC name: Jester01
Version: GIT
OS: Debian Linux

Re: Desperately need ground elevation information!

Postby Amirreza Shakeri » Wed Sep 04, 2019 2:35 am

Hello.

I searched all 50 pages of scenery category to avoid making repetitive topic request. finally i think I'm in the right topic to ask my question.

As my university project is simulation of TAWS (Terrain Avoidance Warning System), i need scenery elevation data to be in .csv form like of three columns containing Latitude, Longitude & altitude to get compared with current aircraft altitude and appropriate warning pops up if necessary.

As i understood GetElevatinM() function returns current elevation, while i need whole scenery elevation data.

Does anybody know what should i do?
Thanks in advance.
Amirreza Shakeri
 
Posts: 8
Joined: Mon Aug 26, 2019 5:55 pm

Re: Desperately need ground elevation information!

Postby wlbragg » Wed Sep 04, 2019 3:11 am

I'm not sure I am understanding exactly what you want.

You want to know how to export property data to cvs or how to get the elevation, or both?

If elevation, you must want the elevation at some distance in front of the aircraft. If that is so then I think you would have to calculate a geo-coordinant position at x-y offset from aircraft location and poll that position to get the elevation of that point or multiple points in that direction.
I'm lousy at math so I can't help with the function but there is code examples in the AirCrane cargo hauling nasal file that crudely do most everything you need. There is example of polling a geo-location, there is even a crude calculation to place an object at x distance behind the aircraft using geo coordinates.

I would imagine there is also many examples of this type of stuff in the Space Shuttle code as well, but I wouldn't have a clue as to where to look exactly.

For example getting an elevation using the geo class looks something like this...
Code: Select all
geo.elevation(offset-lat, offset-lon);


This was a crude positioning of a model at an offset behind the aircraft's coordinates
Code: Select all
#use to offset cargo behind aircraft
        #var x = math.cos((headNode+90)*0.0174533);
        #var y = math.sin((headNode+90)*0.0174533);
        #y = y * -1;
        #x = x * .0000239;
        #y = y * .0000239;


Where headNode is the aircraft's heading. So using this as an example...
Code: Select all
geo.elevation(x, y);

Would technically get you the elevation at some distance behind the aircraft.

I wouldn't be surprised if someone doesn't already have some custom code for one of the military aircraft applications that does what you need.

Also see: http://wiki.flightgear.org/Nasal_library/geo
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 4989
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/AMDRX480

Re: Desperately need ground elevation information!

Postby f-ojac » Wed Sep 04, 2019 2:55 pm

There used to be a tool in FG called fgelev (AFAIR). Used to work nicely. I used it many times to compute elevation when importing bunches of objects in Terrasync DB.
--
If you want to support my Terrasync server, hosted on a private server, you can donate here: http://ns334561.ip-5-196-65.eu/WS2.0/WS ... 2.0.1.html
f-ojac
 
Posts: 1276
Joined: Fri Mar 07, 2008 9:50 am
Version: GIT
OS: GNU/Linux

Re: Desperately need ground elevation information!

Postby Alant » Wed Sep 04, 2019 3:14 pm

I use this in my FLR (Forward Looking Radar) code, which is in turn used my terrain following system for TSR2.

The FLR only scans a narrow cone in front of the aircraft at a scan rate determined by the motion of the radar dish, so the system load is not very high.

Alan
Alant
 
Posts: 916
Joined: Wed Jun 23, 2010 5:58 am
Location: Portugal
Callsign: Tarnish99
Version: from Git
OS: Windows 10

Re: Desperately need ground elevation information!

Postby wlbragg » Wed Sep 04, 2019 4:00 pm

There used to be a tool in FG called fgelev
I use this in my FLR (Forward Looking Radar) code

You used fgelev for the data?
Apparently faster than polling with nas-geo?
How does that work?
I'd like to see that code!
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 4989
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/AMDRX480

Re: Desperately need ground elevation information!

Postby Alant » Wed Sep 04, 2019 4:32 pm

Sorry, missed a copy and paste in my previous post. Here is the code.
Code: Select all
# Function to get Elevation at latitude and longitude

var get_elevation = func (lat, lon) {

   var info = geodinfo(lat, lon);
   if (info != nil) {var elevation = info[0] * METER2FOOT;}
   else {var elevation = -1.0; }
   return elevation;
}
Alant
 
Posts: 916
Joined: Wed Jun 23, 2010 5:58 am
Location: Portugal
Callsign: Tarnish99
Version: from Git
OS: Windows 10

Re: Desperately need ground elevation information!

Postby Necolatis » Wed Sep 04, 2019 5:03 pm

geodinfo gets alot more info than just elevation, isn't it alot slower to use than geo.elevation for that reason, or am I missing something?
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore
User avatar
Necolatis
 
Posts: 2032
Joined: Mon Oct 29, 2012 12:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2019.1.2
OS: Windows 10

Re: Desperately need ground elevation information!

Postby wlbragg » Wed Sep 04, 2019 6:16 pm

or am I missing something


Me too! My post was referring to using geo nas functions regardless of which one in particular. fgelev is a totally different method that I was interested in knowing how to poll that data in real time and using it VS nas geo.

So Alan, you used nas geo to get the FLR data and not fgelev.

What I am wondering is if there is a way to hook into fgelev in real time and if so is there any gain. Something tells me that's not possible. The fact that FG core is already supplying elevation data at the location of the aircraft it might be trivial to add some kind of FLR data gathering routines to the core C code?
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 4989
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/AMDRX480

Next

Return to Scenery

Who is online

Users browsing this forum: Google [Bot] and 1 guest