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

Fix TypeErro by typecasting int in random height calculation #956

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thabsheerjm
Copy link

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.

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.

1 participant