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

cjio crashes when merging empty cityjson (ValueError: math domain error) #156

Open
pcace opened this issue Jan 12, 2023 · 1 comment
Open
Labels
bug Something isn't working

Comments

@pcace
Copy link

pcace commented Jan 12, 2023

cjio crashes when merging multiple files and one is an empty cityJson (according to specification allowed: https://www.cityjson.org/specs/1.1.3/#cityjson-object)

with the following error:

cjio LoD2_33_388_5816_1_BE.json merge "*.json" save merged.json
Parsing LoD2_33_388_5816_1_BE.json
Merging files
Traceback (most recent call last):
  File "/home/user/.local/bin/cjio", line 8, in <module>
    sys.exit(cli())
  File "/home/user/.local/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/user/.local/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/user/.local/lib/python3.9/site-packages/click/core.py", line 1689, in invoke
    return _process_result(rv)
  File "/home/user/.local/lib/python3.9/site-packages/click/core.py", line 1626, in _process_result
    value = ctx.invoke(self._result_callback, value, **ctx.params)
  File "/home/user/.local/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/user/.local/lib/python3.9/site-packages/cjio/cjio.py", line 94, in process_pipeline
    cm = processor(cm)
  File "/home/user/.local/lib/python3.9/site-packages/cjio/cjio.py", line 356, in processor
    cm.merge(lsCMs)
  File "/home/user/.local/lib/python3.9/site-packages/cjio/cityjson.py", line 1258, in merge
    if math.ceil(abs(math.log(cm.j["transform"]["scale"][0], 10))) > imp_digits:
ValueError: math domain error

example files here: (see example3 folder) https://cloud.johannes-froelich.de/s/xtwyW4rrNoeZTE5

any quick fix? since the cityJson files are generated in my case here its hard for me to avoid "empty" cityJson files

cheers and thanks!

@hugoledoux
Copy link
Member

hmmm, it's not the empty file that causes this but the fact that the scale is 0... this should be fixed indeed but in the meantime put 1.0 for scale and this should work

@hugoledoux hugoledoux added the bug Something isn't working label Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants