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

Adaption for pymesh and add condition when geometry not in building #15

Open
StoneLee0917 opened this issue Sep 26, 2023 · 1 comment
Open
Labels
bug Something isn't working

Comments

@StoneLee0917
Copy link

  1. for the new version of CityJSON("version"=1.1), the pymesh library (1.0.2) is not usable anymore. Only runnable without "pip install pymesh". Otherwise, get output: "problem with {id}".
  2. For object without geometry, get error:
    Traceback (most recent call last):
    File "/content/3d-building-metrics/cityStats.py", line 683, in
    main()
    File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1157, in call
    return self.main(*args, **kwargs)
    File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
    File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
    File "/content/3d-building-metrics/cityStats.py", line 591, in main
    r = rtree.index.Index(tree_generator_function(cm, vertices), properties=p)
    File "/usr/local/lib/python3.10/dist-packages/rtree/index.py", line 282, in init
    raise self._exception
    File "/usr/local/lib/python3.10/dist-packages/rtree/index.py", line 1246, in py_next_item
    p_id[0], coordinates, obj = next(stream_iter)
    File "/content/3d-building-metrics/cityStats.py", line 255, in tree_generator_function
    if len(obj["geometry"]) == 0:
    KeyError: 'geometry'
    need to add " if "geometry" not in obj: " condition into function tree_generator_function(cm, verts) and function get_neighbours(cm, obj, r, verts). Happens to "Vienna.city.json" and other datasets on cityjson website.
@liberostelios
Copy link
Collaborator

Hey @StoneLee0917. Thanks for reporting 🙌

  1. Actually, this library was never meant to work with the pypi version of pymesh. Which, confusingly, is a different library than the pymesh we are pointing in the readme. I am sorry for not having it clear enough in the instructions. 🙈
  2. That's true, the library was built with CityJSON v1.0 which required a "geometry" object to exist in every city object. Since you pinpointed the issue, please feel free to make a PR if you can 😊 Otherwise I will address it soon.

@liberostelios liberostelios added the bug Something isn't working label Sep 28, 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