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

Fail force-cube explicitly for missing features #342

Merged
merged 4 commits into from
Feb 18, 2025

Conversation

Florian-Katerndahl
Copy link
Contributor

Previously, an vector file (e.g. GPKG) could be supplied with a corresponding layer name but a feature count of 0. This leads to force-cube getting stuck.

As this was discovered when using force-tile-extent, a check for the return value was added there with an error message indicating to the user what command to re-run to get more information during which step force-cube failed

Previously, an vector file (e.g. GPKG) could be supplied with
a corresponding layer name but a feature count of 0. This leads
to `force-cube` getting stuck.

As this was discovered when using `force-tile-extent`, a check for
the return value was added there with an error message indicating
to the user what command to re-run to get more information during
which step `force-cube` failed
@Florian-Katerndahl
Copy link
Contributor Author

Florian-Katerndahl commented Feb 18, 2025

Does is_integer check for "emptiness"? Otherwise I don't see why that check is necessary as the field is always an integer 🤔
I can't find the defintion of the function when searching through the repo, unfortunately.

@davidfrantz
Copy link
Owner

Thanks Florian,

I never thought about that.

I slightly changed your commit though:

  • better test for non-zero instead of 1. This way even other error codes will be catched
  • for the counts, I changed it such that it is ensured that the variable is actually an integer, and that it should not be less than 1 (i.e., also catching negative numbers)
  • changed the test to rely on the bash library functions (I will push the integer test in a minute)

Thanks,
David

@davidfrantz davidfrantz merged commit c6f94fc into davidfrantz:develop Feb 18, 2025
1 check passed
@davidfrantz
Copy link
Owner

Does is_integer check for "emptiness"? Otherwise I don't see why that check is necessary as the field is always an integer 🤔 I can't find the defintion of the function when searching through the repo, unfortunately.

As said, I pushed it after the merge, it is now in the bash library file. Bash does not have data types. If GDAL changes some things, it is not guaranteed that N_FEATURES holds an integer, it could also be some string.

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