[Gdal-dev] how is yllcorner determined and why

Janeen janeen at splash.princeton.edu
Mon Nov 27 09:18:33 EST 2006


All,

I've a correction to my original post.  I discovered that in trying to 
figure out how the value for yllcorner is calculated by gdal_translate, 
I was using the dy value NOT the dx value, as the line of code states.  
See corrections within mail.

But that leaves me with 2 new questions:

   Why is the dx value used to calculate the yllcorner in the Ascii Grid?
   And what in the original .nc file is the yllcorner  = -269 related to?

Any light shed on this would be appreciated.

Janeen

Janeen wrote:
> Hello All,
>
> I've just tried the gdal_translate utility on a NetCDF file, 
> converting it to the AAIGrid format.  I'm new to the world of GIS and 
> NetCDF also.  So in using the utility, I want to be sure that I 
> understand how all the data from  the  .nc file  makes it over to the 
> ascii file.
>
> I can't quite figure out how the yllcorner value being reported is 
> calculated, and why it is transformed the way it is.  I've looked at 
> the code and gotten as far as this line in aaigriddataset.cpp:
>
>   adfGeoTransform[3]- nYSize * adfGeoTransform[1]
>
> I can't quite get what the variable adfGeoTransform[3] represents from 
> the original .nc file.  The part of the equation:
>    nYSize * adfGeoTransform[1] 
> I understand where those values  come from in my sample file (i.e. 180 
> *  0.994444444444  = 179 ).
  in my example this should be 180 * 0.997222222222 = 179.5

> Given that yllcorner is being reported as -269, that means that the 
> value for adfGeoTransform[3] would be -90.   But what does that value 
> represent in my original netCDF file given the info below?
>

the actual value for adfGeoTransform[3] becomes -89.5  which is the 
southern most latitude value in the .nc file.


> If anyone can give me a description of what is going on here, I would 
> appreciate it.  Below is header  and gdalinfo.
>
> Janeen
>
>
> Here is the gdal header info from my converted .nc file:
>
>   cols        360
>   nrows        180
>   xllcorner    0.500000000000
>   yllcorner    -269.000000000000
>   dx           0.997222222222
>   dy           0.994444444444
>   NODATA_value -10000000000
>
> Here is (relevant) gdalinfo from my .nc file
>   Driver: netCDF/Network Common Data Format
>   Size is 360, 180
>   Coordinate System is `'
>   Origin = (0.500000,-89.500000)
>   Pixel Size = (0.99722222,0.99444444)
>   Corner Coordinates:
>   Upper Left  (   0.5000000, -89.5000000)
>   Lower Left  (   0.5000000,  89.5000000)
>   Upper Right (     359.500,     -89.500)
>   Lower Right (     359.500,      89.500)
>   Center      ( 180.0000000,   0.0000000)
>
>
>
> _______________________________________________
> Gdal-dev mailing list
> Gdal-dev at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/gdal-dev



More information about the Gdal-dev mailing list