OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

Obtain terrain heigth in meters?


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> VirtualPlanetBuilder [vpb]
View previous topic :: View next topic  
Author Message
termite
User


Joined: 10 Jun 2009
Posts: 26

PostPosted: Sun Jun 23, 2013 7:06 pm    Post subject:
Obtain terrain heigth in meters?
Reply with quote

Hello,

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?

Thank you!

Massimo

[EDIT]

I use this formula to calculate a coefficient to convert from degree to meters at a specified latitude:
Code:

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?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> VirtualPlanetBuilder [vpb] All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts How to query height of terrain given ... vinothrajendran4 VirtualPlanetBuilder [vpb] 0 Tue Mar 14, 2017 2:43 pm View latest post
No new posts Height of terrain bhanu406 General 5 Fri Mar 03, 2017 7:56 am View latest post
No new posts Error building terrain with shapefile... robertosfield VirtualPlanetBuilder [vpb] 0 Mon Feb 06, 2017 9:11 am View latest post
No new posts Error building terrain with shapefile... vinothrajendran4 VirtualPlanetBuilder [vpb] 0 Mon Feb 06, 2017 6:24 am View latest post
No new posts How to change terrain elevation manua... vinothrajendran4 VirtualPlanetBuilder [vpb] 1 Wed Jan 04, 2017 5:00 am View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP