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

Breaks on CityObject without geometry #43

Closed
balazsdukai opened this issue Jan 6, 2022 · 3 comments
Closed

Breaks on CityObject without geometry #43

balazsdukai opened this issue Jan 6, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@balazsdukai
Copy link
Member

From CityJSON v1.1 the geometry property is not mandatory anymore for CityObjects. If this is the case, the plugin breaks:

Traceback (most recent call last):
  File "/home/balazs/.local/share/QGIS/QGIS3/profiles/balazs/python/plugins/CityJSON-loader/cityjson_loader.py", line 301, in run
    self.load_cityjson(filepath)
  File "/home/balazs/.local/share/QGIS/QGIS3/profiles/balazs/python/plugins/CityJSON-loader/cityjson_loader.py", line 323, in load_cityjson
    skipped_geometries = loader.load()
  File "/home/balazs/.local/share/QGIS/QGIS3/profiles/balazs/python/plugins/CityJSON-loader/core/loading.py", line 114, in load
    self.layer_manager.add_object(key, obj)
  File "/home/balazs/.local/share/QGIS/QGIS3/profiles/balazs/python/plugins/CityJSON-loader/core/layers.py", line 55, in add_object
    new_features = self._feature_builder.create_features(self._fields, object_key, cityobject)
  File "/home/balazs/.local/share/QGIS/QGIS3/profiles/balazs/python/plugins/CityJSON-loader/core/layers.py", line 230, in create_features
    geom = self._geometry_reader.read_geometry(cityobject["geometry"])
KeyError: 'geometry'

File:
DH_01_subs.zip

@liberostelios
Copy link
Contributor

Thanks for reporting this! How do you think this should be better tackled? Create no feature at all, or create on with an empty geometry?

@balazsdukai
Copy link
Member Author

If qgis allows empty geometries I think it would be good to create features with an empty geometry. That is in case the CO has attributes, they'll be added to the feature.

@liberostelios liberostelios added the bug Something isn't working label Jan 11, 2022
@liberostelios
Copy link
Contributor

I decided to go with the latter option (load with empty geometries). There is only a issue, for now, that if you split features per LoD then all features without a geometry will be excluded (as there is no LoD to load these features at).

Nevertheless, this is now fixed and the fix is included in the latest release.

You can install it here or wait for the new version to be approved in the repository soon and upgrade from within QGIS plugin manager.

Thanks for reporting this again! 🙌

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