Stephane, If you TXP database is in a flat-earth projection, like UTM or state plane, the osg::Ellipsoid functions will not help. They convert to and from geocentric (earth-centered) coordinates.
TerraVista generates a "projInfo.txt" file along with the TXP database. This contains the "txpOffsetX" and "txpOffsetY" properties that tell the local offset of the lower-left corner of your TXP terrain, relative to the geographic projection in which you generated the terrain. So to go from lat/lon to scene coordinates, you need to: 1. convert lat/lon to the terrain's projection (e.g., UTM) 2. translate the resulting coordinates by the offset in the projInfo.txtfile hth -gw On Dec 3, 2007 9:59 AM, Stephane DUGUET <[EMAIL PROTECTED]> wrote: > Hello, > > > > I'm new on OSG scene. > > Here is my issue: > > I have a TXP terrain on which I know the local origin coordinates. This > coordinates are: > > Longitude : -117.642222 > > Latitude : 33.094444 > > > > I now whant to know the local coordinates (within my TXP terrain) of a > know location (GPS cocordinate): > > Longitude: -117.3636264412 > > Latitude: 33.2940335740 > > > > I use ElModel->convertLatLongHeightToXYZ to transform the goedesic > coordinates in caretsian ones. What I need now if to transform the resulting > coordinates according to the origin's location in order to take care of my > offset. > > > > Any idea of how to perform this? > > > > I tried the following: > > > > OriLongitude=-117.642222/*origin*/; > > OriLatitude=33.094444/*origin*/; > > OriAltitude=0; > > ElModel->convertLatLongHeightToXYZ (osg::DegreesToRadians(OriLatitude), > > osg::DegreesToRadians(OriLongitude), > > OriAltitude, > > oriX, > > oriY, > > oriZ ); > > > > > > ElModel->convertLatLongHeightToXYZ (osg::DegreesToRadians(33.2940335740), > > osg::DegreesToRadians(-117.3636264412 > ), > > 0, > > x, > > y, > > z ); > > > > > > xl=-sin(OriLongitude)*(x-oriX)+ cos(OriLongitude)*(y-oriY); > > yl=-sin(OriLatitude)*cos(OriLongitude)*(x-oriX) > > -sin(OriLatitude)*sin(OriLongitude)*(y-oriY) > > +cos(OriLatitude)*(z-oriZ); > > zl=cos(OriLatitude)*cos(OriLongitude)*(x-oriX) > > +cos(OriLatitude)*sin(OriLongitude)*(y-oriY) > > +sin(OriLatitude)*(z-oriZ); > > > > But I still cannot have good results. > > I have some doubts about the "-" sign applied to the longitude for a West > direction. > > > > Thanks for your help, > > > > Best regards, > > > > Stephane > > > > > > > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > -- Glenn Waldron : Pelican Mapping : http://pelicanmapping.com : 703-652-4791
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

