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 <[email protected]>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
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to