I have a GeoTIFF file that QGIS has produced from merging multiple DEM TIFFs together. The gdalinfo for this file is:

Driver: GTiff/GeoTIFF
Files: ca_heightmap.tif
Size is 39601, 39601
Coordinate System is:
    DATUM["World Geodetic System 1984",
        ELLIPSOID["WGS 84",6378137,298.257223563,
        AXIS["geodetic latitude (Lat)",north,
        AXIS["geodetic longitude (Lon)",east,
Data axis to CRS axis mapping: 2,1
Origin = (-125.000138888888998,43.000138888888898)
Pixel Size = (0.000277777777778,-0.000277777777778)
Image Structure Metadata:
Corner Coordinates:
Upper Left  (-125.0001389,  43.0001389) (125d 0' 0.50"W, 43d 0' 0.50"N)
Lower Left  (-125.0001389,  31.9998611) (125d 0' 0.50"W, 31d59'59.50"N)
Upper Right (-113.9998611,  43.0001389) (113d59'59.50"W, 43d 0' 0.50"N)
Lower Right (-113.9998611,  31.9998611) (113d59'59.50"W, 31d59'59.50"N)
Center      (-119.5000000,  37.5000000) (119d30' 0.00"W, 37d30' 0.00"N)
Band 1 Block=39601x1 Type=Float32, ColorInterp=Gray

enter image description here

How can I convert this to a raw file that I am able to import as a terrain in Unity? When I open this TIFF in GIMP, I just get a black/white image that loses the height map aspect (I'm not really sure what happens to it, but it looks like this in GIMP)

enter image description here

  • 1
    GIMP is an image processing program, while your TIFF is a dataset. GIMP won't be able to render a Float32 visually. Have you tried importing it in Unity at all? Oct 24 '20 at 10:34
  • It seems that unity can only accept a raw file for a terrain
    – Hdot
    Oct 24 '20 at 10:37
  • 2
    And what is a "raw file" to Unity? Please link to some specification if possible. Oct 24 '20 at 10:46
  • I'm new to Unity and QGIS, so i'm just going off of what im seeing people say over the forums etc. But when importing a file to be used as a terrain in unity, it expects a .raw file
    – Hdot
    Oct 24 '20 at 10:50
  • ah, I managed to get the correct format using gdal_translate –of ENVI –ot UInt16 –scale –outsize 1025 1025 ca_heightmap.tif heightmap.raw
    – Hdot
    Oct 24 '20 at 11:24

Using the command gdal_translate –of ENVI –ot UInt16 –scale –outsize 1024 1024 ca_heightmap.tif heightmap.raw to get the correct format for Unity

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.