question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GeoTiff: get actual values for min/max/nodata/name per band

See original GitHub issue

Is your feature request related to a problem? Please describe. I’d like to know whether an alpha band has been added to the GeoTiff bands or not. I see that there is a property addAlpha_, but this sounds like a private property and not a public API.

Describe the solution you’d like I’m wondering whether it would be good to add a public API method such as hasAlphaBand() that simply returns this.addAlpha_? Happy to create a PR if that’s they way to go, but also open to other solutions. Maybe I’m missing something, too.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
ahocevarcommented, May 5, 2022

@m-mohr Sorry for the premature reply, you’re absolutely right that the nodata value can also be set from the geotiff.js image’s getGDALNoData() method.

I agree it does make sense to be able to access the nodata values. But for use in an application, it is not only enough to know the nodata value, but also the band index that holds it. So to come up with a meaningful API here, it would be good to know a bit more about your use case. Do you need the nodata value for the layer style, or for something completely different?

0reactions
m-mohrcommented, May 5, 2022

@ahocevar Yes, such a data object would help a lot.

I don’t specify any information in the source info right now (except normalize: false and the URL of the source). What I do then is to apply styling once I know the min/max values, basically doing linear stretching. no-data “styling” I also tried to do, but that did not work yet (i.e. something like if band value matches no-data value then 0, else 1). But I run into some issues with that approach, which I could not really debug yet (how to debug the styling expressions?). For some files the styling approach works, for some not (yet?).

I’m also stumbling across some parts of the documentation, where I’m not sure they are always correct. For example, in https://openlayers.org/en/latest/apidoc/module-ol_style_expressions.html#~ExpressionValue it says the value you get for bands is 0…1, but is that also the case if normalize is false? And what exactly does convertToRGB do… it makes it work for grayscale, but then fails for me when I’m loading RGB files, which is weird because I’d assume converting from RGB to RGB would basically do nothing. 😃 But I’m slowly digging deeper…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Showing values from a GeoTIFF - GIS Stack Exchange
Using gdalinfo -stat -hist filename.tif will show accurate min/max/mean/stdev and an histogram: ... Band 1 Block=3600x1 Type=Int16, ...
Read more >
GTiff – GeoTIFF File Format — GDAL documentation
GDAL stores band nodata value in the non standard TIFFTAG_GDAL_NODATA ASCII tag (code 42113) for files created with the default profile GDALGeoTIFF.
Read more >
OGC GeoTIFF Standard
At image level, band i of an image is the rectangular array of i th sample values from the pixel vectors. 4.2. cell....
Read more >
Information about GeoTIFF file - MATLAB geotiffinfo - MathWorks
info = geotiffinfo( url ) reads the GeoTIFF image from a URL. ... Find the projected coordinate reference system (CRS) for the boston.tif...
Read more >
GeoTIFF - Blue Marble Geographics
Multi-band - This option generates a raster GeoTIFF file with 1 or more bands of data at either 8-, 16-, or 32-bits per...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found