Fix TypeErro by typecasting int in random height calculation #956
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request addresses a TypeError in the io_import_osm.py file, which occurs when the code attempts to call random.randint() with float values.
Error msg : TypeError: 'float' object cannot be interpreted as an integer
The problem arises when values such as minH and maxH are floats, but random.randint() expects integer arguments. This issue is typically encountered when generating random building heights, where minH and maxH are derived from height values that can be float types.
Cause : The issue was introduced because random.randint() was being called with float values, which is invalid. This error surfaced after a recent merge.
Solution: minor change ->typecasting on assignment to minH and maxH.
Testing:
The error was replicated using a building extrusion where the height tag was set to a float value. After the fix, the code works as intended, and the error no longer occurs.