<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body><div><font face="sans-serif">Does your terrain display correctly in osgviewer? Make sure elevation data exists for the given lat lon...</font></div><div><font face="sans-serif"><br></font></div><div><font face="sans-serif">Shayne</font></div><div><br></div><div><br></div><div><br></div><div id="composer_signature"><div style="font-size:85%;color:#575757" dir="auto">Sent via the Samsung Galaxy S7 active, an AT&T 4G LTE smartphone</div></div><div><br></div><div style="font-size:100%;color:#000000"><!-- originalMessage --><div>-------- Original message --------</div><div>From: Siyamak Mohammadinejad <smplife64@gmail.com> </div><div>Date: 12/28/17 5:25 AM (GMT-07:00) </div><div>To: osg-users@lists.openscenegraph.org </div><div>Subject: [osg-users] How to get height above terrain in lat/long location? </div><div><br></div></div>Hi,<br><br>I have problem to get height above terrain with this code: <br><br>Code:<br><br>double X;<br>double Y;<br>double Z;<br>double maxElevationInDatabase = 8848; // meters, Mount Everest<br>osgTerrain::Terrain* t = dynamic_cast<osgTerrain::Terrain*>(terrainNode_.get());<br>osg::CoordinateSystemNode* csn = dynamic_cast<osg::CoordinateSystemNode*>(t);<br>osg::EllipsoidModel* em = csn ? csn->getEllipsoidModel() : 0;<br>if (em)<br>{<br>em->convertLatLongHeightToXYZ(osg::DegreesToRadians(lattitude), osg::DegreesToRadians(longitude), maxElevationInDatabase, X, Y, Z);<br>hat = osgSim::HeightAboveTerrain::computeHeightAboveTerrain(terrainNode_.get(), osg::Vec3d(X, Y, Z));<br>hot = maxElevationInDatabase - hat;<br>}<br><br>hat is always 8848 :( <br><br>My code to generate terrain is:<br>Code:<br>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<br><br><br><br>Thank you!<br><br>Cheers,<br>Siyamak[/code]<br><br>------------------<br>Read this topic online here:<br>http://forum.openscenegraph.org/viewtopic.php?p=72646#72646<br><br><br><br><br><br>_______________________________________________<br>osg-users mailing list<br>osg-users@lists.openscenegraph.org<br>http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org<br></body></html>