Skip to content

TerrainLoader returns empty arrays when loading binary files #7

@qbytx

Description

@qbytx

Hello!
First of all, thank you for your great blog post on the subject of three.js and terrain meshes.

I tried following your blog's instructions as closely as possible, but I cannot get your TerrainLoader to parse the binary files I created with GDAL. However, if I use the files from your blog in your repos (e.g., jotunheimen.bin) the TerrainLoader parses that just fine.

I am trying to use arbitrary geotiffs because I want to be able to use your method for several DEM's.

Let me walk you through my steps:

  1. I downloaded this topographic image of the earth

  2. I used GDAL to convert the jpeg to a geotiff with the following command:
    gdal_translate -a_srs WGS84 -a_ullr -180 +90 +180 -90 earth.jpg earth.tiff

  3. I used Gdalinfo to confirm the geotiff created had the correct metadata (it did)

  4. I used the command at the end of your blogpost to convert this geotiff to a binary file

gdal_translate -scale 982 1905 0 65535 -ot UInt16 -of ENVI earth.tif earth.bin

this created 3 files, including a .bin, I placed all three files in a directory in my node application, then I tried to load it using your TerrainLoader:

var terrainLoader = new THREE.TerrainLoader(); terrainLoader.load('./data/earth.bin', function(data) { console.log(data); });

And I get back an array of UInt16, but every index in the array is '0'. So there is no elevation data, any idea what I'm doing wrong? I'd really love to make this work!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions