Hi Tianyun, The OSG itself doesn't manage mercator projections, so if you want to covnert being different coordinate systems then you are best using a 3rd party library like GDAL.
What osg::EllipsoidModel can do is handle the whole earth ellisoid and converson of lats/long to Earth Center Earth Fixed, this is sufficent for most whole terrain databases and why the OSG specifically supports it. Robert. On 24 April 2013 08:47, Tianyun Su <[email protected]> wrote: > Hi, > I use osgdem to create an IVE model with mercator projection and can load the > model in my OSG program. I want to realize such funciton: > (1) input the WGS84 coordinate (lon, lat) of target point > (2) calculate the elevation (z) of the point from the terrain file > (3) draw a graphic object at the point (lon, lat, z) > The problem is how to convert the WGS84 coordinate of inputted point to > mercator projection which is used in my OSG program. > > I have used the folllowing method: > > > Code: > osg::ref_ptr<osg::CoordinateSystemNode> csn=new osg::CoordinateSystemNode; > csn->setEllipsoidModel(new osg::EllipsoidModel); > csn->addChild(terrain);//"terrain" is IVE model with mercator projection > double o,p,q; > csn->getEllipsoidModel()->convertLatLongHeightToXYZ(osg::DegreesToRadians(80.0),osg::DegreesToRadians(115.0),osg::DegreesToRadians(0.0),o,p,q); > > > The convert value (o,p,q) is not correct. > How can I realize the function? > > Thank you! > > Cheers, > tianyun[/code] > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=53776#53776 > > > > > > _______________________________________________ > 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

