I have looked through all of the forum posts related to this issue and they 
have implicitly but not explicitly told me how to solve my problem, but being 
such a newbie I think I need some explicit help  :-* 

I am starting with two geoTiff files, one dem and one terrain.  I convert to 
ive using the following command line structure:

osgdem -t terrain.GEOTIFF -d dem.GEOTIFF -l 1 -o terrain.ive

I am able to load terrain.ive into my osg application and view it just fine.  I 
then want to be able to add objects (e.g. tree osg files) onto the terrain.  At 
this point I should mention that the geotiff files are in UTM WGS84 format.  I 
have been trying to add a tree onto the terrain with the following osg code:


Code:

/*
        Load Scene Components from Files
        */
        osg::ref_ptr<osg::Node> terrain = 
osgDB::readNodeFile("data\\terrain\\terrain.ive");
        osg::ref_ptr<osg::Node> tree = 
osgDB::readNodeFile("data\\tree\\Tree1.osg");


        /*
        Group Scene Components
        */

        /*Tree Transform*/
        osg::ref_ptr<osg::PositionAttitudeTransform> treeXform = new 
osg::PositionAttitudeTransform;
        osg::Vec3 treePosit(?,?,?);
        treeXform->setPosition( treePosit ); 
        osg::Vec3 treeScale(1,1,1);
        treeXform->setScale(treeScale);
        /*Tree Rotation*/
        osg::ref_ptr<osg::MatrixTransform> treeRotation = new 
osg::MatrixTransform;
        const double angle = osg::DegreesToRadians(0.0);
        const Vec3d axis(1, 0, 0);
        treeRotation->setMatrix(Matrix::rotate(angle, axis));

        osg::ref_ptr<osg::Group> root = new osg::Group();
        root->addChild(terrain);//add terrain to root
        root->addChild(treeXform);//add translation to root
        treeXform->addChild(treeRotation);//add rotation to translation
        treeRotation->addChild(tree);//add tree to rotation




My question is whether this osg command / osg code is on track and I simply 
need to figure out appropriate values for my treePosit variable or whether I 
need to take a fundamentally different approach.  I have read about attaching 
objects to geotiffs that were converted using the --geocentric flag, but if I 
add the --geocentric flag I get the following error:
ERROR 1: No PROJ.4 translation for source SRS, coordinate transformation 
initialization has failed.  I have also seen the --TERRAIN flag for osgdem, but 
I definitely don't know if that's what I need.  

I have also looked into using osgEarth, which from what I've read might take 
care of more of this stuff automatically, but I'd rather figure this out using 
VPB/osgdem since I think I'm really close to a solution.  Thanks in advance for 
any help!

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





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to