[osg-users] Unable to place model on vpb terrain. How To ?

Glenn Waldron gwaldron at gmail.com
Sat Apr 9 10:07:25 PDT 2011


Sanat,

The method won't work because your VPB database is not geocentric. It is
projected (UTM). A non-geocetric db won't have an EllipsoidModel.

Setting an EM won't work. The EllipsoidModel conversion methods only convert
between geodetic (lat/long) and geocentric.

The conversion works in osgEarth because osgEarth automatically detects the
terrain's coordinate system and knows how to convert between UTM, geodetic,
and geocentric.

Bottom line is, you cannot place something on your UTM database using
lat/long coordinates without first converting lat/long to UTM.

HTH, Glenn


Glenn Waldron / Pelican Mapping / 703.652.4791 / @glennwaldron


On Fri, Apr 8, 2011 at 2:10 PM, Sanat Talmaki <sanat.schumi at gmail.com>wrote:

> Hi,
>
> I am trying to place a model on a vpb terrain by supplying the lat-long
> coordinates.
>
> I followed a couple of threads in the forum that suggested to use the
> CoordinateSystemNode and ellipsoid model. But that didn't work for me (or
> maybe I am not following it right).
>
> I have attached the terrain along with my post.
>
> So far this is what I am doing:
>
>
> Code:
> osg::ref_ptr<osg::Group> root = new osg::Group();
>
>  osg::ref_ptr<osg::CoordinateSystemNode> csn = new
> osg::CoordinateSystemNode();
>  csn->setEllipsoidModel(new osg::EllipsoidModel());
>  osg::ref_ptr<osg::Group> terrainGroup = new osg::Group();
>  //osg::ref_ptr<osg::Node> terrain =
> osgDB::readNodeFile("NorthCampus6Levels.osg");
>  osg::ref_ptr<osg::Node> terrain =
> osgDB::readNodeFile("NorthCampus6LevelsNoCS.osg");
>  terrainGroup->addChild(terrain);
>
>  osg::Vec3d m_surface;
>  csn->getEllipsoidModel()->convertLatLongHeightToXYZ(osg::DegreesToRadians(42.291966f),
> osg::DegreesToRadians(-83.715645f), 0.0f,
>
>  double(m_surface.x()),double(m_surface.y()),double(m_surface.z())
>                                                     );
>
>
>
> I tried using a visitor to find the CoordSystNode in my scenegraph but when
> I checked getEllipsoidModel I got a null.
>
> I have used osgEarth in the past and was able to place a model on that. But
> I presently need to use vpb. If anyone can point me in the right direction,
> it would be great.
>
> Thank You.
>
> Sincerely,
> Sanat
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=38336#38336
>
>
>
>
> Attachments:
> http://forum.openscenegraph.org//files/northcampus6levels_171.osg
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20110409/ce047d1e/attachment-0004.htm>


More information about the osg-users mailing list