Skip to content

Add get_extent to COG#1845

Merged
sharkAndshark merged 27 commits intomaplibre:mainfrom
sharkAndshark:cog_web_3
May 27, 2025
Merged

Add get_extent to COG#1845
sharkAndshark merged 27 commits intomaplibre:mainfrom
sharkAndshark:cog_web_3

Conversation

@sharkAndshark
Copy link
Collaborator

It's the 3rd PR of #1814 to fix #1820

A func to get the extent from COG is added. It's highly inspired by geotiff.js and the content of B.6 of geotiff spec

@sharkAndshark sharkAndshark marked this pull request as ready for review May 22, 2025 06:49
@sharkAndshark sharkAndshark requested a review from Copilot May 22, 2025 06:49
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a new function to compute the extent for a Cloud Optimized GeoTIFF (COG) based on input metadata and transformation matrices.

  • Introduces a new extent field in the Meta struct.
  • Adds helper functions get_full_resolution and get_extent to compute image resolution and extent.
  • Updates error types to handle failures in computing resolution and extent.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
martin/src/cog/source.rs Adds functions for resolution and extent computation
martin/src/cog/errors.rs Introduces new error variants for resolution/extent failures

@sharkAndshark sharkAndshark marked this pull request as draft May 23, 2025 05:45
Copy link
Member

@CommanderStorm CommanderStorm left a comment

Choose a reason for hiding this comment

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

from my side, we could btw ship it.

@sharkAndshark sharkAndshark requested a review from Copilot May 26, 2025 13:50
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds functionality to calculate the geographic extent of a COG by introducing a new field in the Meta struct and implementing the get_extent function along with related utility functions.

  • Added an extent field to the Meta struct and updated get_meta to compute it.
  • Introduced get_full_resolution and get_extent functions to compute image resolution and geographic extents.
  • Updated error handling and extended tests to verify the new extent and full resolution calculations.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
martin/src/cog/source.rs Adds extent calculation logic including get_full_resolution and get_extent functions, as well as test cases.
martin/src/cog/errors.rs Introduces an error variant for GetFullResolutionFailed with updated error messaging.

sharkAndshark and others added 2 commits May 26, 2025 21:56
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@sharkAndshark sharkAndshark marked this pull request as ready for review May 26, 2025 15:43
@sharkAndshark sharkAndshark enabled auto-merge (squash) May 27, 2025 07:24
@sharkAndshark sharkAndshark merged commit d4d4a13 into maplibre:main May 27, 2025
20 checks passed
@sharkAndshark
Copy link
Collaborator Author

thx! @CommanderStorm

@sharkAndshark sharkAndshark deleted the cog_web_3 branch May 27, 2025 07:50
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.

Make COG web friendly

3 participants