[gdal-dev] gdal_translate from .nc --> .tif --- issue with coordinates
Hill, David Foster
David.Hill at oregonstate.edu
Thu Jul 15 12:44:54 PDT 2021
Hello. I asked this question a few weeks ago, but I think my question was not complete enough, and I also think I did not attach the right files. So, I would like to try again, if that is ok.
I have a .nc file. When I do:
>>ncdump -c <file.nc>
I can inspect the coordinates in the x and y directions. When I do this, it shows the x vector correctly as: 487200, 487300,…625300. And it shows the y vector correctly as 4690100, 4690200,…4937600. My file is in projected (EPSG:32612) coords.
Next, I use gdal_translate to change .tif. I do this as:
gdal_translate -of GTiff <file.nc> <file.tif>
This is my question —> after converting to tif, I can look at the header info with gdalinfo. When I do this, I see:
****
Corner Coordinates:
Upper Left ( 486790.000, 4937650.000)
Lower Left ( 486790.000, 4690050.000)
Upper Right ( 624990.000, 4937650.000)
Lower Right ( 624990.000, 4690050.000)
Center ( 555890.000, 4813850.000)
****
The y coord of lower left is 4690050…compare that to the info above about the .nc file. I think this is ok. It is 50m different. Presumably, ncdump is reporting on the coords of grid centers and gdalinfo is reporting on boundaries (1/2 a grid cell difference), so it is 50 m less. Fine. BUT, look at the x coord of the lower left grid cell. It is 486790, compared to 487200 in the netcdf file. In other words, the x coord of the tif file is like 410 m less than the netcdf file. I am very confused about the difference in the x coordinate vector between the .nc and the .tif files.
Is there a different way that I should be using gdal_translate to avoid this 400 m ‘offset’? I can certainly override the limits with -a_ullr, and that works fine, and gives me the expected coordinate values and 100 m grid resolution, etc. However, that does not seem like the most elegant solution.
Dave.
files here: https://drive.google.com/drive/folders/1CclJGBj_L_Z-9hq_Xkse0ARKDdnNvKZJ?usp=sharing <https://drive.google.com/drive/folders/1CclJGBj_L_Z-9hq_Xkse0ARKDdnNvKZJ?usp=sharing>
---------------------------------------------------
David F. Hill
Professor
Civil and Construction Engineering
Oregon State University
220 Owen Hall
Corvallis, OR 97331
541.737.4939
david.hill at oregonstate.edu
http://www.engr.oregonstate.edu/~dfh
---------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20210715/c4d647fd/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1563 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20210715/c4d647fd/attachment.bin>
More information about the gdal-dev
mailing list