Joined: 10 Jun 2009
|Posted: Sun Jun 23, 2013 7:06 pm Post subject:
Obtain terrain heigth in meters?
i have no problem to get terrain height in meters if the terrain has a UTM projected GCS. But if a use Geographic system, the terrain intersection is in degrees. Of course i can use a coefficient to convert from degree to meters, but i think it can't give good results.
Probably i'm missing something.
There is a "standard" way to get such value?
I use this formula to calculate a coefficient to convert from degree to meters at a specified latitude:
void degree2meters(float latitude, float* lonmeters, float* latmeters)
double M_PI = 3.1415927 ;
float lat = latitude * (M_PI / 180.0);
float m1 = 111132.92;
float m2 = -559.82;
float m3 = 1.175;
float m4 = -0.0023;
float p1 = 111412.84;
float p2 = -93.5;
float p3 = 0.118;
*latmeters = (m1 + (m2 * cos(2 * lat)) + (m3 * cos(4 * lat)) + (m4 * cos(6 * lat))) ;
*lonmeters = ((p1 * cos(lat)) + (p2 * cos(3 * lat)) + (p3 * cos(5 * lat))) ;
I have tested it and the results seems good.
Someone can tell me if VPB use a similar formula to convert DEM values to degrees unit during terrain generation?