David, I ran into the same issue. What I did was to move the database so that it's centered on the origin and use the conversion specified by Philip Taylor in a previous email to calculate the scaling needed to apply to an osg::AutoTransform node.
... // Recenter(origin) the database osg::ref_ptr<osg::AutoTransform> move = new osg::AutoTransform; move.get()->setPosition(osg::Vec3(-bs.center().x(), -bs.center().y(), 0.0));//bs.center().z())); // Re-scale the database to try to make 1 unit == 1 meter osg::ref_ptr<osg::AutoTransform> scale = new osg::AutoTransform; scale.get()->setScale(osg::Vec3(_metersPerDegree * _converge, _metersPerDegree, _metersPerDegree)); move->addChild(database.get()); scale->addChild(move.get()); // Add the moved, scaled dbase to the root subgraph.get()->addChild(scale.get()); ... You then have to use the conversion already discussed to place anything else in the environment, if you want it placed to a specific lat/lon or meter offset. The nice thing about this technique is that it's relatively easy to re-origin everything to preserve positional numerical precision. Cheers, Brad P.S. Nice last name ;) --- RSC BDC > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:osg-users- > [EMAIL PROTECTED] On Behalf Of David Colbert > Sent: Tuesday, August 01, 2006 4:13 PM > To: osg users > Subject: Re: [osg-users] osgdem terrain scaling problem > > My mistake. I thought gdal and osgdem would perform this conversion for me > once I entered all of my geospecific anchor points into the metadata. > > Is anyone out there using any other tool as an intermediary between gdal > and osgdem to accomplish this conversion? I'd like to be able to add some > metadata to an archive of geotiifs once and be able to crop any terrain > out of them without having to write my own coordinate > system/projection/units/datum conversion routines each time. > > Thanks, > David > > > On 8/1/06, Robert Osfield <[EMAIL PROTECTED]> wrote: > > Hi David, > > The OSG doesn't have any particular units, it just works with the > data > you have. If your data ranges from 0 to 10 then its just render > that, > its up to your app how your interepret it. > > Robert. > > On 8/1/06, David Colbert <[EMAIL PROTECTED]> wrote: > > Antoine, thanks for the osgpick suggestion. It confirmed my > problems... > > > > It appears to be a units problem that I am having. OSG app units > are meters. > > My terrain units are all degrees, so a 10 degree by 10 degree > terrain shows > > up in OSG as a 10 meter by 10 meter terrain. Does anyone know how > to output > > the terrain in meters? I tried gdalwarping the file from > degrees into > > meters by running it through a gdalwarp -t_srs 'EPSG:4326 > +units=meters' > > in.tif out.tif, which did change the "degree" unit to "metre" unit > as > > returned by gdalinfo. > > > > However, when I run the new file through osgdem, I still get a 10 > meter by > > 10 meter terrain. Does osgdem recognize these units changes? I > went back and > > made a bunch of test terrains with DEM, SRTM, geotiff, DTEDs, and > they all > > ended up as many meters wide as they were degrees wide, no matter > how I > > warped them or changed their metadata. > > > > Any ideas? > > > > Thanks in advance, > > David > > > > > > > > > > On 8/1/06, Antoine Hue <[EMAIL PROTECTED]> wrote: > > > David Colbert wrote: > > > > Hello All, > > > > > > > > <snip> > > > > > > > > My terrain looks okay in osgviewer, but when I load it into my > app, > > > > it's tiny. Like less than 10 meters across tiny. Obviously, my > scale > > > > is messed up, but I cannot find out what more I need to do. I > set the > > > > corner anchors using -a_ullr; I tagged 3 points with gcp to > provide > > > > additional geocorrelation information; and I set the > coordinate system > > > > to match the coordinate system in the README pdf for the blue > marble > > > > imagery. > > > > > > > > Did I do something wrong? Is this a bug? Any help would be > much > > > > appreciated. The example with pegout says that -xx -yy is > unecessary > > > > if you have all the geo metadata, which I believe that I do. > > > > > > > Hello David, > > > > > > You are right, -xx and -yy are not needed in your case. > > > You may check the actual coordinates using osgpick instead of > osgviewer > > > (same command usage). > > > > > > Antoine > > > > > > > > > _______________________________________________ > > osg-users mailing list > > [email protected] > > http://openscenegraph.net/mailman/listinfo/osg-users > > http://www.openscenegraph.org/ > > > > > _______________________________________________ > osg-users mailing list > [email protected] > http://openscenegraph.net/mailman/listinfo/osg-users > <http://openscenegraph.net/mailman/listinfo/osg-users> > http://www.openscenegraph.org/ > > _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
