bugra9 / gdal3.js

Convert raster and vector geospatial data to various formats and coordinate systems entirely in the browser.
https://gdal3.js.org
GNU Lesser General Public License v2.1
315 stars 48 forks source link

Unable to open tiff #43

Closed danothemen closed 1 year ago

danothemen commented 1 year ago

I'm using vite + react and can't seem to open up a tiff file. I just get an exception with an undefined message. Having pulled some parts from the example for vite + vue and opening a file from the network I wound up with the following.

initGdalJs({ paths }).then(async (Gdal) => {
      const sec = await fetch("/billings_sec.tif");
      const file = new File([await sec.blob()], "/billings_sec.tif");
      const openResult = await Gdal.open(file);
      console.log("Opened Sec With GDAL", openResult);
    });

The above winds up just throwing an exception with an undefined message. Is there something obviously wrong with my set-up or some other steps that I can take to further debug? image

danothemen commented 1 year ago

Closing, because I've discovered that having the "/" in the file name is what broke this for me. A nicer error message would still be nice though. Thanks for the wasm port!