equinor / equinor/leaflet.tilelayer.gloperations

Support for GeoTIFF

Open
#57 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
30
Forks
7
PR merge metrics
No merged PRs in 30d

Description

Hi,

Thanks for this excellent plugin.

I have a single-band GeoTIFF file for elevation data. Would it be possible to fetch the file locally and get it to work with your module?
Please excuse my inexperience in this but I can't figure it out myself or if it is already possible with `tileFormat = dem` .

My thinking is to have the option for `arraybuffer` instead of `url` and/or `tileFormat = tiff` then modify the code for `_fetchTileData` to handle either `arraybuffer` directly or process through geotiff.js library like below.

```
fetch("file.tif")
.then(function (response) {
return response.arrayBuffer();
})
.then(function (arrayBuffer) {
return GeoTIFF.fromArrayBuffer(arrayBuffer);
})
.then(function (tiff) {
return tiff.getImage();
})
.then(function (image) {
const width = image.getWidth();
const height = image.getHeight();
const extent = image.getBoundingBox();
const raster = image.readRasters();
const rgbImage = image.readRGB();
})
```

Sorry about the code but I'm just listing the different values to get from geotiff.js.

Also, I found [this code in here](https://observablehq.com/@toja/shaded-relief) that can handle tiff files with an example file if it can be of help.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.