[GRASSLIST:4483] hgt to bil (SRTM)

Dear Users,
I'm trying to understand how to create the hdr file for the .bil srtm
dem I downloaded....
I have found too much different information... so I try with you....:
if I have a N11E044.hgt file I have to rename the file to N11E044.bil
and then to create a N44E011.hdr file...
can you help me to insert the right value in the ULXMAP and ULYMAP
sections of the hdr file below.... ???

BYTEORDER M
LAYOUT BIL
NROWS 1201
NCOLS 1201
NBANDS 1
NBITS 16
BANDROWBYTES 2402
TOTALROWBYTES 2402
BANDGAPBYTES 0
NODATA -32768
ULXMAP ???
ULYMAP ???
XDIM 0.000833333333333
YDIM 0.000833333333333

Thank you very much....
Ivan

I had to wrestle with this and here's what I figured out. First, the cells in the SRTM are center-based, so you need to take into account 1/2 the cell for the UL corner. And there is a 1 cell overlap between tiles. So, if you have a cell as your example:

1. add 1.00041666666667 to latitude for ULYMAP
  12.00041666666667
2. subtract 0.00041666666667 from longitude for ULXMAP
  43.9995833333

this will put the corner in the correct position 1/2 cell outside the upper-left.

On May 17, 2006, at 4:50 AM, ivan marchesini wrote:

Dear Users,
I'm trying to understand how to create the hdr file for the .bil srtm
dem I downloaded....
I have found too much different information... so I try with you....:
if I have a N11E044.hgt file I have to rename the file to N11E044.bil
and then to create a N44E011.hdr file...
can you help me to insert the right value in the ULXMAP and ULYMAP
sections of the hdr file below.... ???

BYTEORDER M
LAYOUT BIL
NROWS 1201
NCOLS 1201
NBANDS 1
NBITS 16
BANDROWBYTES 2402
TOTALROWBYTES 2402
BANDGAPBYTES 0
NODATA -32768
ULXMAP ???
ULYMAP ???
XDIM 0.000833333333333
YDIM 0.000833333333333

Thank you very much....
Ivan

-----
William Kyngesburye <kyngchaos@charter.net>
http://webpages.charter.net/kyngchaos/

All generalizations are dangerous, even this one.

On Wed, May 17, 2006 at 11:50:51AM +0200, ivan marchesini wrote:

Dear Users,
I'm trying to understand how to create the hdr file for the .bil srtm
dem I downloaded....
I have found too much different information...

In fact, there are many wrong documents in the Web.
Even the USGS docs were silently (!) fixed in December 2003.

so I try with you....:
if I have a N11E044.hgt file I have to rename the file to N11E044.bil
and then to create a N44E011.hdr file...

- SRTM filename coordinates are said to be the *center* of the LL pixel.
       N51E10 -> lower left cell center
- BIL uses *center* of the UL (!) pixel:
      http://downloads.esri.com/support/whitepapers/other_/eximgav.pdf
  
- GDAL uses *corners* of pixels for its coordinates (?)

[...]
Please have a look at
http://mpa.itc.it/rs/srtm/index.html

where you can grab ready-to-use scripts:

srtm_generate_hdr.sh: general shell script to make GeoTIFF from original
  SRTM90 files. Requires GDAL tools to be installed.

r.in.srtm: GRASS script to import original SRTM files. Requires above script
  to be installed in PATH. Fixes the INTEGER encoding, applies color table.
  To use in Lat/Long LOCATIONS (WGS84, to be precise EGM96).

Even the NASA is using it :slight_smile:
http://xserve.flids.com/pipermail/geotiff/2004-August/000052.html

Hope this helps

Markus

Oh blast! Just figured out that GDAL takes care of the cell center -> cell edge conversion of the header. So my method shifted everything NW 1/2 cell. So it's even simpler: the ULXMAP is the tile longitude, and add 1 to the latitude for the ULYMAP.

Good thing I noticed before importing the whole US next week. And that's probably why the VMAP0 coasts didn't match very well before :slight_smile:

On Oct 7, 2004, at 12:29 PM, William K wrote:

I had to wrestle with this and here's what I figured out. First, the cells in the SRTM are center-based, so you need to take into account 1/2 the cell for the UL corner. And there is a 1 cell overlap between tiles. So, if you have a cell as your example:

1. add 1.00041666666667 to latitude for ULYMAP
  12.00041666666667
2. subtract 0.00041666666667 from longitude for ULXMAP
  43.9995833333

this will put the corner in the correct position 1/2 cell outside the upper-left.

On May 17, 2006, at 4:50 AM, ivan marchesini wrote:

Dear Users,
I'm trying to understand how to create the hdr file for the .bil srtm
dem I downloaded....
I have found too much different information... so I try with you....:
if I have a N11E044.hgt file I have to rename the file to N11E044.bil
and then to create a N44E011.hdr file...
can you help me to insert the right value in the ULXMAP and ULYMAP
sections of the hdr file below.... ???

BYTEORDER M
LAYOUT BIL
NROWS 1201
NCOLS 1201
NBANDS 1
NBITS 16
BANDROWBYTES 2402
TOTALROWBYTES 2402
BANDGAPBYTES 0
NODATA -32768
ULXMAP ???
ULYMAP ???
XDIM 0.000833333333333
YDIM 0.000833333333333

Thank you very much....
Ivan

-----
William Kyngesburye <kyngchaos@charter.net>
http://webpages.charter.net/kyngchaos/

All generalizations are dangerous, even this one.

-----
William Kyngesburye <kyngchaos@charter.net>
http://webpages.charter.net/kyngchaos/

"Time is an illusion - lunchtime doubly so."

- Ford Prefect