How to get the longitude and latitude?

classic Classic list List threaded Threaded
3 messages Options
VGEZJ VGEZJ
Reply | Threaded
Open this post in threaded view
|

How to get the longitude and latitude?

We can view the earth scene in OSG. but how use mouse to pick up the longitude and  latitude of a points in 3D scene?
jasonbeverage jasonbeverage
Reply | Threaded
Open this post in threaded view
|

Re: How to get the longitude and latitude?

Hi,

The best way to accomplish that would be to use the viewer::computeIntersections method to get the geocentric coordinates of the mouse location.  See the osgpick example for an example on how to do picking with osg.

After you have the geocentric coordinates, you can use the MapNode::findCoordinateSystemNode function in osgEarth to find the root osg::CoordinateSystemNode that decorates the osgEarth node.  From there, you can the coordinateSystemNode->getEllipsoidModel()->convertXYZToLatLongHeight to get that lat/lon in radians.

Jason

On Wed, Aug 19, 2009 at 9:31 AM, VGEZJ (via Nabble) - No Reply <[hidden email]> wrote:
We can view the earth scene in OSG. but how use mouse to pick up the longitude and  latitude of a points in 3D scene?


View message @ http://n2.nabble.com/How-to-get-the-longitude-and--latitude--tp3472248p3472248.html
To start a new topic under osgEarth, email [hidden email]
To unsubscribe from osgEarth, click here.


VGEZJ VGEZJ
Reply | Threaded
Open this post in threaded view
|

Re: How to get the longitude and latitude?

Thanks!