tudelft3d / 3d-building-metrics

Tool to compute shape metrics from 3D geometries for buildings
MIT License
39 stars 10 forks source link

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

Open StoneLee0917 opened 1 year ago

StoneLee0917 commented 1 year ago
  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 commented 1 year ago

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.