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

Load local file using fromBlob #433

Open
synasir opened this issue Aug 6, 2024 · 0 comments
Open

Load local file using fromBlob #433

synasir opened this issue Aug 6, 2024 · 0 comments

Comments

@synasir
Copy link

synasir commented Aug 6, 2024

Hi all,

I am using this code to try and load a local Geotiff file. The file is from https://download.osgeo.org/geotiff/samples/usgs/i30dem.tif. Not sure why it is not running. It will never reach document.write('C');

Thanks.

<!DOCTYPE html>
<html lang="en">
<head>
    <title>GeoTIFF Load</title>    
</head>
<body>
    <h1>GeoTIFF Load</h1>
    <input type="file" id="file">     
    <script src="geotiff.js"></script>
    <script>
    //https://download.osgeo.org/geotiff/samples/usgs/i30dem.tif
    document.write('A');
    const input = document.getElementById('file');    
    document.write('B');
    input.onchange = async function() {
    const tiff = await fromBlob(input.files[0]);    
    const image = await tiff.getImage();
    const data = await image.readRasters();
    const width = image.getWidth();
    document.write('C');
    }    
    </script>
</body>
</html>
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