Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@weigert
Copy link
Contributor

@weigert weigert commented Mar 4, 2025

This PR adds support for tiled .TIFF files. This is related to issue #58. If merged, the API remains unchanged but the feature is then supported.

This has been tested and works for a number of datasets from SwissALTI3D and DGM Data from the Upper Austrian government.

The implementation mimics the implementation of readStripData as readTileData. To reduce duplicate code, the decompression switch was isolated into a separate function.

Additionally, the fillX functions were removed, as they only work with linearized data / the assumption of a linear index. Instead, they were replaced with a single sampleValue function, which can be called directly in readStripData or readTileData with the specific indexing procedure while still being extensible to support more formats.

There is a minor consideration that the "check" which is the stored format is now performed once per iteration, instead of calling a specialized function once (per strip) which is iterated inside. These checks could be removed by selecting a callback once at the beginning of the function and using that to sample the value. I am not sure what is more performant in transpiled typescript though, de-referencing an additional callback or 3 if statements. I didn't want to introduce more / opinionated code than necessary, so this is the "minimum viable" change.

The tile reading implementation can be compared to libtiff in C/C++ here and here.

@codecov
Copy link

codecov bot commented Mar 4, 2025

Codecov Report

Attention: Patch coverage is 40.25974% with 46 lines in your changes missing coverage. Please review.

Project coverage is 74.66%. Comparing base (de5d521) to head (66180c9).
Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
src/tiffDecoder.ts 42.18% 35 Missing and 2 partials ⚠️
src/tiffIfd.ts 30.76% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #60      +/-   ##
==========================================
- Coverage   79.89%   74.66%   -5.23%     
==========================================
  Files          12       12              
  Lines         562      604      +42     
  Branches      110      120      +10     
==========================================
+ Hits          449      451       +2     
- Misses        106      144      +38     
- Partials        7        9       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@weigert
Copy link
Contributor Author

weigert commented Mar 5, 2025

Attached are two sample images which have different tiled layouts for testing, from different sources (one from Upper Austria DGM and one from SwissALTI3D).
swissalti3d_2020_2745-1234_0.5_2056_5728.zip
UpperAustriaDGM_Frankenburg_G-T4734-77.zip

@weigert weigert changed the base branch from main to release-please--branches--main--components--tiff March 5, 2025 15:53
@weigert weigert changed the base branch from release-please--branches--main--components--tiff to main March 5, 2025 15:53
@weigert
Copy link
Contributor Author

weigert commented Mar 5, 2025

For some reason, github is not correctly updating the diff after I rebased the branch. The files changed are clearly incorrect (at time of writing).

@weigert weigert closed this Mar 5, 2025
@weigert weigert deleted the tiled branch March 5, 2025 16:06
@stropitek
Copy link

The main branch in your repo is out of sync with this one so rebasing with your main branch adds changes unrelated to this PR on this branch.

@weigert
Copy link
Contributor Author

weigert commented Mar 5, 2025

I realized this. The PR was closed, I synced my main branch, branched and readded the changes. A new PR #62 has been opened.

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

Successfully merging this pull request may close these issues.

2 participants