Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TerrainLoader returns empty arrays when loading binary files #7

Open
qbytx opened this issue Jul 2, 2021 · 1 comment
Open

TerrainLoader returns empty arrays when loading binary files #7

qbytx opened this issue Jul 2, 2021 · 1 comment

Comments

@qbytx
Copy link

qbytx commented Jul 2, 2021

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!

@qbytx
Copy link
Author

qbytx commented Jul 3, 2021

I was able to substitute terrainloader with geotiff.js and read the geotiff's directly rather than as binary file. I'm still interested in understanding how to make your terrainloader work / what I did wrong. : )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant