-
Notifications
You must be signed in to change notification settings - Fork 203
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
GeoTIFF loader #1280
Comments
@zakjan this could be a nice addition. If you are interested in working on this happy to sync on the best approach. |
Hey folks, I'm trying to display a GeoTIFF orthophoto on a Is it currently possible to use the GeoTIFF module to load aerial images into a |
The viv team (who do molecular biology visualizations using deck.gl, see the deck.gl showcases page) have used OME TIFF with deck.gl to great effect. They contributed their loader to loaders.gl but unfortunately there has not been sufficient time to get everything working with GeoTIFFs so it remains an undocumented module. I saw a recent post from @kylebarron around the topic so maybe there is something in the works. If you are serious about getting this working in a reusable way I can provide more support. |
I don't have any plans myself to work on/improve a GeoTIFF loader in JS. You may want to read the documentation for the underlying geotiff.js as well |
The existing loaders.gl code is here: https://github.com/visgl/loaders.gl/tree/master/modules/geotiff |
@ibgreen @kylebarron After spending a few hours banging my head on the keyboard I've finally managed to display a simple GeoTIFF orthophoto as a Deck.GL layer using Most of the time, it was a learning experience and I ended up trying many things until I found a solution that worked.
Here's how I did it: import { fromArrayBuffer } from "geotiff";
const loadGeoTiff = async (data: ArrayBuffer) => {
// Load using Geotiff.js
const tiff = await fromArrayBuffer(data);
// Assumes we only have one image inside TIFF
const image = await tiff.getImage();
// Read image and size
const rgbData = await image.readRGB({enableAlpha: true});
const width = image.getWidth();
const height = image.getHeight();
// Create a new ImageData object
const imageData = new ImageData(width, height);
imageData.data.set(new Uint8ClampedArray(rgbData as unknown as Uint8Array));
return imageData;
}
export const GeoTiffLoader = {
id: "GeoTIFF",
name: 'GeoTIFF',
module: '',
version: '1',
options: {},
mimeTypes: ["image/tiff", "image/geotiff"],
extensions: ['geotiff', 'tiff'],
parse: loadGeoTiff,
}; Let me know if this is a good (and acceptable) starting point for a contribution. |
@giovannicimolin I think this would be a very nice contribution. For full control we need to build something like a We would need an (ideally small) geotiff sample file (either in the test/data directory or contributed to deck.gl-data repo) and a test case that loaded it successfully. For longer term:
|
Target Use case
Loading GeoTIFF raster data (including float bands) and rendering them with deck.gl-raster
Proposed feature
@loaders.gl/geotiff package using geotiff.js inside
The text was updated successfully, but these errors were encountered: