Hi David,
 
To make sense of your data, gdal must know where on the planet your ten x ten degree patch is located. The following simple algorithm does not solve your problem, but may highlight where the problem lies or hint at a solution to your conversion problem.
 
To convert ten degrees in latitude is simple - convert the degrees into metres. Ten degrees in longitude is harder, since it depends on the angle above (or below) the equator. If the same transform for latitude was used on the longitude, your square database would become a tall rectangle.
 
    // **********************************************************************
    // This simple algorithm assumes a perfectly spherical world
    // **********************************************************************
    // Converting a latitude to a grid is achieved by multiplying the
    // angular difference in latitude by the number of nautical miles
    // in a degree of latitude.
    // **********************************************************************
 
    {
        Northing  = ( Latitude - Origin_Latitude ) 
* 60;          // Convert degrees to Nautical Miles
 
        Northing = ( Northing * 1852 ) + Origin_Northing;     // convert Nm to metres from origin pt
    }
 
    // **********************************************************************
    // The size of a degree of Longitude depends on the latitude since
    // a degree of longitude will have same size as a degree of latitude
    // at the equator, and a value of zero at the pole. The assumption
    // is that the size of the degree of longitude is a function of the
    // cosine of the degree of latitude.
    // **********************************************************************
 
    {
        Easting  = (Longitude - Origin_Longitude ) 
* cos(Latitude * DEG_TO_RAD ) * 60;    // Convert  degrees to Nautical Miles
 
        Easting = ( Easting * 1852 ) + Origin_Easting;       // convert Nm to metres from origin pt
    }
 
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of David Colbert
Sent: 01 August 2006 20:19
To: Antoine Hue
Cc: osg users
Subject: Re: [osg-users] osgdem terrain scaling problem

Antoine, thanks for the osgpick suggestion. It confirmed my problems...

It appears to be a units problem that I am having. OSG app units are meters. My terrain units are all  degrees, so a 10 degree by 10 degree terrain shows up in OSG as a 10 meter by 10 meter terrain. Does anyone know how to output the terrain in  meters?  I tried  gdalwarping the file from degrees into meters by running  it through a gdalwarp -t_srs 'EPSG:4326 +units=meters' in.tif out.tif, which did change the "degree" unit to "metre" unit as returned by gdalinfo.

However, when I run the new file through osgdem, I still get a 10 meter by 10 meter terrain. Does osgdem recognize these units changes? I went back and made a bunch of test terrains with DEM, SRTM, geotiff, DTEDs, and they all ended up as many meters wide as they were degrees wide, no matter how I warped them or changed their metadata.

Any ideas?

Thanks in advance,
David



On 8/1/06, Antoine Hue <[EMAIL PROTECTED]> wrote:
David Colbert wrote:
> Hello All,
>
> <snip>
>
> My terrain looks okay in osgviewer, but when I load it into my app,
> it's tiny. Like less than 10 meters across tiny. Obviously, my scale
> is messed up, but I cannot find out what more I need to do. I set the
> corner anchors using -a_ullr; I tagged 3 points with gcp to provide
> additional geocorrelation information; and I set the coordinate system
> to match the coordinate system in the README pdf for the blue marble
> imagery.
>
> Did I do something wrong? Is this a bug? Any help would be much
> appreciated. The example with pegout says that -xx -yy is unecessary
> if you have all the geo metadata, which I believe that I do.
>
Hello David,

You are right, -xx and -yy are not needed in your case.
You may check the actual coordinates using osgpick instead of osgviewer
(same command usage).

Antoine

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to