File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -55,9 +55,7 @@ export async function fetchTile(
5555 translation ( x * self . tileWidth , y * self . tileHeight ) ,
5656 ) ;
5757
58- // https://github.com/blacha/cogeotiff/pull/1394
59- const samplesPerPixel =
60- ( self . image . value ( TiffTag . SamplesPerPixel ) as number ) ?? 1 ;
58+ const samplesPerPixel = self . image . value ( TiffTag . SamplesPerPixel ) ?? 1 ;
6159
6260 const decodedPixels = await decode ( bytes , compression , {
6361 sampleFormat,
Original file line number Diff line number Diff line change @@ -221,7 +221,7 @@ export class GeoTIFF {
221221
222222 /** Number of bands (samples per pixel). */
223223 get count ( ) : number {
224- return ( this . image . value ( TiffTag . SamplesPerPixel ) as number ) ?? 1 ;
224+ return this . image . value ( TiffTag . SamplesPerPixel ) ?? 1 ;
225225 }
226226
227227 /** Bounding box [minX, minY, maxX, maxY] in the CRS. */
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ export interface CachedTags {
99 nodata : number | null ;
1010 photometric : TiffTagType [ TiffTag . Photometric ] ;
1111 sampleFormat : TiffTagType [ TiffTag . SampleFormat ] ;
12- samplesPerPixel : number ; // TiffTagType[TiffTag.SamplesPerPixel];
12+ samplesPerPixel : TiffTagType [ TiffTag . SamplesPerPixel ] ;
1313}
1414
1515/** Pre-fetch TIFF tags for easier visualization. */
@@ -52,8 +52,7 @@ export async function prefetchTags(image: TiffImage): Promise<CachedTags> {
5252 // Uint is the default sample format according to the spec
5353 // https://web.archive.org/web/20240329145340/https://www.awaresystems.be/imaging/tiff/tifftags/sampleformat.html
5454 sampleFormat : sampleFormat ?? [ SampleFormat . Uint ] ,
55- // Waiting for release with https://github.com/blacha/cogeotiff/pull/1394
56- samplesPerPixel : samplesPerPixel as number ,
55+ samplesPerPixel,
5756 } ;
5857}
5958
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ describe("decode", () => {
1414 const sampleFormat =
1515 ( image . value ( TiffTag . SampleFormat ) as SampleFormat [ ] | null ) ?. [ 0 ] ??
1616 SampleFormat . Uint ;
17- const samplesPerPixel = image . value ( TiffTag . SamplesPerPixel ) as number ;
17+ const samplesPerPixel = image . value ( TiffTag . SamplesPerPixel ) ?? 1 ;
1818
1919 const result = await decode ( tile ! . bytes , tile ! . compression , {
2020 sampleFormat,
@@ -43,7 +43,7 @@ describe("decode", () => {
4343 const sampleFormat =
4444 ( image . value ( TiffTag . SampleFormat ) as SampleFormat [ ] | null ) ?. [ 0 ] ??
4545 SampleFormat . Uint ;
46- const samplesPerPixel = image . value ( TiffTag . SamplesPerPixel ) as number ;
46+ const samplesPerPixel = image . value ( TiffTag . SamplesPerPixel ) ?? 1 ;
4747
4848 const result = await decode ( tile ! . bytes , tile ! . compression , {
4949 sampleFormat,
You can’t perform that action at this time.
0 commit comments