Re: [osg-users] convertLatLongHeightToXYZ
On 12 November 2016 at 08:56, Rambabu Repakawrote: > Hi,Can anyone post a code where function converts latitude,longitude,height > to x,y,z and returns the x,y,z coordinates in osg. You don't need anyone to post code for you, if you have the OSG you already have the code. Just look at the OSG examples that use the osg::EllipsoidModel. You really shouldn't need the community to hand hold you through every line of code. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] convertLatLongHeightToXYZ
Hi,Can anyone post a code where function converts latitude,longitude,height to x,y,z and returns the x,y,z coordinates in osg. ... Thank you! Cheers, Rambabu -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=69339#69339 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] convertLatLongHeightToXYZ
Hi, Thank you everyone for your replies. In fact, I made a mistake because I built my terrain with VPB with the option --geocentric so my terrain is geocentric. I didn't remember anymore. In fact, I rotate the terrain and that's why it seem flat. But your answers helped me a lot because I might build flat terrain. Thank you! Cheers, lucie -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32343#32343 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] convertLatLongHeightToXYZ
Hi, In fact, my model is not spheroid, it is a flat terrain. That's why I need simply the position. Thank you! Cheers, lucie -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32257#32257 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] convertLatLongHeightToXYZ
Lucie, If you're on a flat earth, you shouldn't be using the convertLatLongHeightToXYZ method. This is only used for mapping spheroid coordinates to geocentric (origin is at the center of the spheroid) coordinates. Because you were referencing this method, it was assumed that you were using this type of mapping. If you want to get X,Y from a Lat,Long pair, you need to use some other projection or mapping. You could use a Plate Carree projection or something similar http://en.wikipedia.org/wiki/Equirectangular_projection. May I also suggest that you use something like GeoTrans or GDAL to assist you in what you need to do. -Shayne -Original Message- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of lucie lemonnier Sent: Friday, October 01, 2010 3:06 AM To: osg-users@lists.openscenegraph.org Subject: Re: [osg-users] convertLatLongHeightToXYZ Hi, In fact, my model is not spheroid, it is a flat terrain. That's why I need simply the position. Thank you! Cheers, lucie -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32257#32257 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org smime.p7s Description: S/MIME cryptographic signature ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] convertLatLongHeightToXYZ
Lucie, FYI, the osgEarth project contains a SpatialReference class that provides general coordinate conversion functionality. (It uses GDAL/OGR under the hood.) You might take a look at this for ideas. http://osgearth.org Glenn Waldron : Pelican Mapping On Fri, Oct 1, 2010 at 9:50 AM, Tueller, Shayne R Civ USAF AFMC 519 SMXS/MXDEC shayne.tuel...@hill.af.mil wrote: Lucie, If you're on a flat earth, you shouldn't be using the convertLatLongHeightToXYZ method. This is only used for mapping spheroid coordinates to geocentric (origin is at the center of the spheroid) coordinates. Because you were referencing this method, it was assumed that you were using this type of mapping. If you want to get X,Y from a Lat,Long pair, you need to use some other projection or mapping. You could use a Plate Carree projection or something similar http://en.wikipedia.org/wiki/Equirectangular_projection. May I also suggest that you use something like GeoTrans or GDAL to assist you in what you need to do. -Shayne -Original Message- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of lucie lemonnier Sent: Friday, October 01, 2010 3:06 AM To: osg-users@lists.openscenegraph.org Subject: Re: [osg-users] convertLatLongHeightToXYZ Hi, In fact, my model is not spheroid, it is a flat terrain. That's why I need simply the position. Thank you! Cheers, lucie -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32257#32257 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] convertLatLongHeightToXYZ
Hi, Thank you for your replies! This helps me a lot! Cheers, lucie -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32203#32203 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] convertLatLongHeightToXYZ
Hi, The function ellipsoid-computeLocalToWorldTransformFromLatLongHeight(osg::DegreesToRadians(lat),osg::DegreesToRadians(lon), altitude, position); give me the same values of X,Y,Z as if I use directly the function ellipsoid-convertLatLongHeightToXYZ(osg::DegreesToRadians(lat),osg::DegreesToRadians(lon), altitude, position); I don't understand. Can you clear up me? Thank you! Cheers, lucie -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32232#32232 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] convertLatLongHeightToXYZ
Yes, they're both equivalent in that they return position info but the former returns a matrix for you to use in your transform node so that your model will be positioned correctly on the spheroid. I believe the up vector of the model will then match the up vector at that position on the spheroid so that things are oriented correctly (i.e. a car appears upright sitting on the ground). -Shayne -Original Message- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of lucie lemonnier Sent: Thursday, September 30, 2010 10:09 AM To: osg-users@lists.openscenegraph.org Subject: Re: [osg-users] convertLatLongHeightToXYZ Hi, The function ellipsoid-computeLocalToWorldTransformFromLatLongHeight(osg::DegreesToRadia ns(lat),osg::DegreesToRadians(lon), altitude, position); give me the same values of X,Y,Z as if I use directly the function ellipsoid-convertLatLongHeightToXYZ(osg::DegreesToRadians(lat),osg::Degrees ToRadians(lon), altitude, position); I don't understand. Can you clear up me? Thank you! Cheers, lucie -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32232#32232 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org smime.p7s Description: S/MIME cryptographic signature ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] convertLatLongHeightToXYZ
Hi, Can you explain me a little the function osg::EllipsoidModel::convertXYZToLatLongHeight? I don't understand why x and y are calculated based on height. If I changed the height of a model and I don't change the latitude and longitude, x and y change. Why? Thank you! Cheers, lucie -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32166#32166 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] convertLatLongHeightToXYZ
HI Lucie, The XYZ are in Earth Center Earth Fixed coordinates, not local coordinates to surface of the earth. Robert. On Wed, Sep 29, 2010 at 9:52 AM, lucie lemonnier lucielemonn...@hotmail.fr wrote: Hi, Can you explain me a little the function osg::EllipsoidModel::convertXYZToLatLongHeight? I don't understand why x and y are calculated based on height. If I changed the height of a model and I don't change the latitude and longitude, x and y change. Why? Thank you! Cheers, lucie -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32166#32166 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] convertLatLongHeightToXYZ
Hi, I understood that the XYZ are in Earth Center Earth Fixed coordinates. So is it normal that X,Y are calculated based on height? In fact, I put a latitude, longitude and height on a model, I use osg::EllipsoidModel::convertLatLongHeightToXYZ to obtain the position x,y,z and I transform my point with the MatrixTransforms applied on the terrain model and I place my model with the transformed point. Is it the step to be followed? Thank you! Cheers, lucie -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32170#32170 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] convertLatLongHeightToXYZ
Hi Lucie, On Wed, Sep 29, 2010 at 10:43 AM, lucie lemonnier lucielemonn...@hotmail.fr wrote: I understood that the XYZ are in Earth Center Earth Fixed coordinates. So is it normal that X,Y are calculated based on height? I'm a bit confused by your question, in ECEF the coordinate is always XYZ, one doesn't ever just consider XY, this would just be a projection of the each onto a flat cross section through the side of the each, not sure what use this would be. In fact, I put a latitude, longitude and height on a model, I use osg::EllipsoidModel::convertLatLongHeightToXYZ to obtain the position x,y,z and I transform my point with the MatrixTransforms applied on the terrain model and I place my model with the transformed point. Is it the step to be followed? One normally uses a transform node to enable one to place local coordinates into the ECEF coordinate frame without lose of precision when computing intersections and doing rendering. The osgTerrain NodeKit uses transforms to avoid numerical issues, so have a look at src/osgTerrain/GeometryTechnique.cpp it see how it computes it's transform and local coordinates. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] convertLatLongHeightToXYZ
Hi, Thank you for your reply. I will look at this. Cheers, lucie -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32173#32173 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] convertLatLongHeightToXYZ
Lucie, This is how you would place your model... osg::Matrixd position; ellipsoid-computeLocalToWorldTransformFromLatLongHeight(osg::DegreesToRadia ns(lat), osg::DegreesToRadians(lon), altitude, position); transform-setMatrix(position); where transform is an osg::MatrixTransform node that has your model as a child node. The X,Y,Z geocentric Cartesian coordinates from the lat,lon,alt can be extracted by: osg::Vec3d pos = position.getTrans(); Keep in mind that an altitude of zero will yield a point on the surface of the spheroid for a given lat,lon pair. Any altitude zero is the height above the ellipsoid/spheroid. Hope this helps... -Shayne -Original Message- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of lucie lemonnier Sent: Wednesday, September 29, 2010 3:44 AM To: osg-users@lists.openscenegraph.org Subject: Re: [osg-users] convertLatLongHeightToXYZ Hi, I understood that the XYZ are in Earth Center Earth Fixed coordinates. So is it normal that X,Y are calculated based on height? In fact, I put a latitude, longitude and height on a model, I use osg::EllipsoidModel::convertLatLongHeightToXYZ to obtain the position x,y,z and I transform my point with the MatrixTransforms applied on the terrain model and I place my model with the transformed point. Is it the step to be followed? Thank you! Cheers, lucie -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32170#32170 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org smime.p7s Description: S/MIME cryptographic signature ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org