Skip to content
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

Add overview support for imports #13

Merged
merged 17 commits into from
Mar 31, 2025
Merged

Conversation

migurski
Copy link
Collaborator

@migurski migurski commented Mar 21, 2025

  • Reduced dual GDAL pipes to a single one in each script
  • Added calculation of overviews for all zoom levels back to z=0 using a recursive descent to keep only a small window of the original raster in memory

Part of #8

@migurski migurski self-assigned this Mar 21, 2025
@migurski migurski marked this pull request as ready for review March 22, 2025 19:51
@migurski migurski requested a review from cayetanobv March 22, 2025 20:06
@migurski
Copy link
Collaborator Author

migurski commented Mar 23, 2025

Sample overviews of test file tests/Annual_NLCD_LndCov_2023_CU_C1V0.tif using nearest-neighbor resampling:

tile-11-339-798 tile-10-169-399 tile-9-84-199 tile-8-42-99 tile-7-21-49 tile-6-10-24

@migurski migurski changed the title Add overview support for import and export Add overview support for imports Mar 27, 2025
Copy link
Member

@cayetanobv cayetanobv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's working; several comments only:

  • minresolution and overviews created. We're setting minresolution=0 because we're computing all overviews, which is not useful in all use cases. It's better to follow the GDAL strategy, computing the minresolution overview depending on the geographical area covered. More comments below in the code.
  • Stats: we should support approximate stats. In large rasters to compute exact stats is a huge overhead, and probably you can work fine with approximate stats when the purpose is visualization. The approach in this PR is computing stats block by block, which is memory safe, but it could be slow for big rasters.
  • Weird issue: The colointerp capitalized is not interpreted correctly in CARTO (GDAL returns as is included here). The colortable is not used if the optional stat "top_values" doesn't exist. We can talk about that because this is something specific to CARTO.

@migurski
Copy link
Collaborator Author

  • Stats: we should support approximate stats. In large rasters to compute exact stats is a huge overhead, and probably you can work fine with approximate stats when the purpose is visualization. The approach in this PR is computing stats block by block, which is memory safe, but it could be slow for big rasters.

Do you recommend that we need to do it in this PR, or is this a suggestion for future work?

@cayetanobv
Copy link
Member

  • Stats: we should support approximate stats. In large rasters to compute exact stats is a huge overhead, and probably you can work fine with approximate stats when the purpose is visualization. The approach in this PR is computing stats block by block, which is memory safe, but it could be slow for big rasters.

Do you recommend that we need to do it in this PR, or is this a suggestion for future work?

It's a suggestion to improve the script. We can add it to the backlog

@migurski migurski requested a review from cayetanobv March 28, 2025 21:28
Copy link
Member

@cayetanobv cayetanobv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment about overviews strategy following GDAL defaults

@migurski migurski requested a review from cayetanobv March 29, 2025 17:51
@migurski migurski merged commit 84eee42 into master Mar 31, 2025
1 check passed
@migurski migurski deleted the migurski/add-overview-support branch March 31, 2025 03:40
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