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

Suggestion: Ignore patches that are completely empty #509

Open
mradamcox opened this issue Oct 2, 2024 · 2 comments
Open

Suggestion: Ignore patches that are completely empty #509

mradamcox opened this issue Oct 2, 2024 · 2 comments
Labels
enhancement New feature or request new feature

Comments

@mradamcox
Copy link

Is your feature request related to a problem? Please describe.
Many georeferenced maps will be oriented at an angle, while the entire file itself is rectangular. When patches are created, this can result in patches that are completely empty--all pixels are "no value". Skipping these patches altogether could speed up the patchify process (and everything that comes later).

image

map.patchify_all(method="pixel", patch_size=1000)

image

Describe the solution you'd like
I'm wondering if there would be any negative downstream effects of simply skipping these patches during the patchifyl process, so that they are not processed. For example, a check here could just skip the save and add_to_parent operations if a patch only has no data values in it (checking for what is truly "no data" would be the tricky part, but that should be in the metadata of the file, I think...).

Additional context
May be best to have this as a flag in the patchify_all() method.

GeoTIFF (COG) shown above:
alexandria_la_1896_p3_1__jwYGc9_00.zip

@rwood-97
Copy link
Collaborator

rwood-97 commented Oct 3, 2024

Hi, I think this is a great idea - it's not something we'd come across since most of our maps are from a tilelayer and so don't have huge amounts of blank space but it makes total sense for people using individual sheets.

Do you want to have a go at doing this (we'd be very excited to get a outside contribution to the code) or if not I'm happy to add it to my list of upcoming things to do.

@mradamcox
Copy link
Author

Great, I'd be happy to try to work on this soon. Will make a PR when I can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request new feature
Projects
Status: Upcoming
Development

No branches or pull requests

2 participants