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 

How to get height above terrain in lat/long location?


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
smp (Siyamak Mohammadinejad)
Newbie


Joined: 10 May 2017
Posts: 2
Location: Tehran, Iran

PostPosted: Thu Dec 28, 2017 12:25 pm    Post subject:
How to get height above terrain in lat/long location?
Reply with quote

Hi,

I have problem to get height above terrain with this code:
Code:

double X;
double Y;
double Z;
double maxElevationInDatabase = 8848; // meters, Mount Everest
osgTerrain::Terrain* t = dynamic_cast<osgTerrain::Terrain*>(terrainNode_.get());
osg::CoordinateSystemNode* csn = dynamic_cast<osg::CoordinateSystemNode*>(t);
osg::EllipsoidModel* em = csn ? csn->getEllipsoidModel() : 0;
if (em)
{
em->convertLatLongHeightToXYZ(osg::DegreesToRadians(lattitude), osg::DegreesToRadians(longitude), maxElevationInDatabase, X, Y, Z);
hat = osgSim::HeightAboveTerrain::computeHeightAboveTerrain(terrainNode_.get(), osg::Vec3d(X, Y, Z));
hot = maxElevationInDatabase - hat;
}
hat is always 8848 Sad

My code to generate terrain is:
Code:
osgdem --bluemarble-west -t land_shallow_topo_west.tif --bluemarble-east -t land_shallow_topo_east.tif -d SRTM_1arc-sec.tif --geocentric --HEIGHT_FIELD --LOD --POLYGONAL --PagedLOD --TERRAIN -v 5 -l 10 -o earth.ive


Thank you!

Cheers,
Siyamak[/code]
Back to top
View user's profile Send private message Send e-mail
smp (Siyamak Mohammadinejad)
Newbie


Joined: 10 May 2017
Posts: 2
Location: Tehran, Iran

PostPosted: Fri Jan 19, 2018 9:26 am    Post subject:
How to get height above terrain in lat/long location?
Reply with quote

Hi,

I have problem to get height above terrain with this code:

Code:

double X;
double Y;
double Z;
double maxElevationInDatabase = 8848; // meters, Mount Everest
osgTerrain::Terrain* t = dynamic_cast<osgTerrain::Terrain*>(terrainNode_.get());
osg::CoordinateSystemNode* csn = dynamic_cast<osg::CoordinateSystemNode*>(t);
osg::EllipsoidModel* em = csn ? csn->getEllipsoidModel() : 0;
if (em)
{
em->convertLatLongHeightToXYZ(osg::DegreesToRadians(lattitude), osg::DegreesToRadians(longitude), maxElevationInDatabase, X, Y, Z);
hat = osgSim::HeightAboveTerrain::computeHeightAboveTerrain(terrainNode_.get(), osg::Vec3d(X, Y, Z));
hot = maxElevationInDatabase - hat;
}

hat is always 8848 Sad

My code to generate terrain is:
Code:
osgdem --bluemarble-west -t land_shallow_topo_west.tif --bluemarble-east -t land_shallow_topo_east.tif -d SRTM_1arc-sec.tif --geocentric --HEIGHT_FIELD --LOD --POLYGONAL --PagedLOD --TERRAIN -v 5 -l 10 -o earth.ive



Thank you!

Cheers,
Siyamak[/code]

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=72646#72646







------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message Send e-mail
shayne.tueller
Guest





PostPosted: Fri Jan 19, 2018 3:49 pm    Post subject:
How to get height above terrain in lat/long location?
Reply with quote

Does your terrain display correctly in osgviewer? Make sure elevation data exists for the given lat lon...


Shayne






Sent via the Samsung Galaxy S7 active, an AT&T 4G LTE smartphone



-------- Original message --------
From: Siyamak Mohammadinejad <>
Date: 12/28/17 5:25 AM (GMT-07:00)
To:
Subject: How to get height above terrain in lat/long location?



Hi,

I have problem to get height above terrain with this code:

Code:

double X;
double Y;
double Z;
double maxElevationInDatabase = 8848; // meters, Mount Everest
osgTerrain::Terrain* t = dynamic_cast<osgTerrain::Terrain*>(terrainNode_.get());
osg::CoordinateSystemNode* csn = dynamic_cast<osg::CoordinateSystemNode*>(t);
osg::EllipsoidModel* em = csn ? csn->getEllipsoidModel() : 0;
if (em)
{
em->convertLatLongHeightToXYZ(osg::DegreesToRadians(lattitude), osg::DegreesToRadians(longitude), maxElevationInDatabase, X, Y, Z);
hat = osgSim::HeightAboveTerrain::computeHeightAboveTerrain(terrainNode_.get(), osg::Vec3d(X, Y, Z));
hot = maxElevationInDatabase - hat;
}

hat is always 8848 Sad

My code to generate terrain is:
Code:
osgdem --bluemarble-west -t land_shallow_topo_west.tif --bluemarble-east -t land_shallow_topo_east.tif -d SRTM_1arc-sec.tif --geocentric --HEIGHT_FIELD --LOD --POLYGONAL --PagedLOD --TERRAIN -v 5 -l 10 -o earth.ive



Thank you!

Cheers,
Siyamak[/code]

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=72646#72646







------------------
Post generated by Mail2Forum
Back to top
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General 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 set the transparency for one o... adrianj General 0 Tue Feb 06, 2018 3:19 am View latest post
No new posts Terrain Deformation as per Road Profile umesh VirtualPlanetBuilder [vpb] 0 Mon Dec 04, 2017 4:44 pm View latest post
No new posts Camera collision with terrain ht11 General [3rdparty] 0 Fri Oct 13, 2017 7:34 am View latest post
No new posts Continuous Terrain moet General 14 Sat Sep 16, 2017 7:51 pm View latest post
No new posts Adapting a height field with a triang... reedev General 5 Tue Sep 05, 2017 7:16 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