TransWikia.com

Converting a UTM .bil file to a lat/long TIFF

Geographic Information Systems Asked on July 17, 2021

I have many 3 arcsec (90m) SRTM DEM files in BIL format in UTM projection that I need to convert into 1 arcsec (30m) lat/long TIFFs. I have tried both gdal_translate and gdalwarp to no success.

First I tried using gdalwarp with the command:

$ gdalwarp -of GTiff -t_srs '+proj=longlat +datum=WGS84
 +no_defs' -tr 0.000277777778 0.000277777778 -r bilinear 
s56w071.bil s56w071_GDAL.tif

It would not run saying that I needed to free up disk space and that the "output file that is 12970800P x 12970800L", which is incorrect and why it needed more space. For this scene at 1 arcsec (0.000277777778) resolution, it should produce a grid size of 3601P X 3601L.

Then I tried gdal_translate so I can force the grid dimensions to be 3601 x 3601, which should equal 1 arcsec data (ie.0.000277777778) . I used

$ gdal_translate -of GTiff -a_srs WGS84 -outsize 3601 3601
 -r bilinear s56w071.bil s56w071_GDAL.tif

It completed the process, but the metadata of the target file still has its Origin and coordinates in UTM measurements, in addition to the pixel size still being meters rather than arcsec.

Driver: GTiff/GeoTIFF
Files: n07w083_testOUTSIZE.tif
Size is 3601, 3601
Coordinate System is:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433],
    AUTHORITY["EPSG","4326"]]
Origin = (-298801.500000000000000,28801.500000000000000)
Pixel Size = (1.000555401277423,-1.000555401277423)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  ( -298801.500,   28801.500) (Invalid angle,Invalid angle)
Lower Left  ( -298801.500,   25198.500) (Invalid angle,Invalid angle)
Upper Right ( -295198.500,   28801.500) (Invalid angle,Invalid angle)
Lower Right ( -295198.500,   25198.500) (Invalid angle,Invalid angle)
Center      ( -297000.000,   27000.000) (Invalid angle,Invalid angle)
Band 1 Block=3601x1 Type=CFloat32, ColorInterp=Gray
  NoData Value=-32767

What did I do wrong as neither command worked correctly? I’m wondering if it is because the header file of the BIL file has everything in UTM space, although I would have thought this would all have been converted. See below:

BYTEORDER I
LAYOUT BIL
NROWS 1201
NCOLS 1201
NBANDS 1
NBITS 16
BANDROWBYTES 2402
TOTALROWBYTES 2402
BANDGAPBYTES 0
NODATA -32767
ULXMAP -298800
ULYMAP 28800
XDIM 3.0
YDIM 3.0

The reason I am trying to do this is because I am attempting to compare the SRTM DEMs to Copernicus DEM, which I have in the desired format (TIFF, geographic, 1 arcsec) so I need to get the SRTM data to have the same specs as Copernicus for the comparison. I am open to other methods, but it needs to be an efficient process because this will be run on thousands of files. For example, it would be really cool if there is a way in GDAL where I can process the SRTM data by feeding it the metadata from the Copernicus files? That way I could be assured that all the necessary metadata gets passed into the processing of the target file.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP