cityjson / cityjson-qgis-plugin

A QGIS plugin that adds support for CityJSON files
Apache License 2.0
35 stars 8 forks source link

LoD1_solidsWithTIN #37

Closed AdrianKriger closed 1 year ago

AdrianKriger commented 2 years ago

Hi. I am unable to load a LoD1 CityModel into qgis successfully. qgis=Zürich in a conda environment. (I've tried with an earlier version but it keeps crashing) cityJSON=here.

The model loads into ninja. With qgis; the buildings (solids) fail to display. The tinrelief does. The only settings: are defining the crs (EPSG:32733) and Split layers according to object type.

I don't know if the following is relevant: When passing parsing the model through val3dity the tinrelief fails ~ Error 305 MULTIPLE_CONNECTED_COMPONENTS. Is this because the tin has isolated features (courtyards ~ interior of buildings) disconnected from the larger terrain?

Have I created the CityObject incorrectly? or am I not defining the qgis parameters correctly?

Your attention is appreciated. Adrian.

Athelena commented 2 years ago

I just had a quick play and I noticed that if you remove from the building attributes "osm_tags" then the buildings can be visualised in QGIS. Can't tell you why though 😅 @liberostelios will know better for sure. I'm guessing it's something to do with parsing the nested hierarchy.

AdrianKriger commented 2 years ago

One thumbs up @Athelena - for the super service and a :smile: for the grammar.

Do you suggest non-nested attributes? Should I write the CityJSON differently? How did you remove the attributes?

Athelena commented 2 years ago

Haha, no worries! Happy to help 😄

So what you store in your file is not wrong, you're allowed to have nested attributes according to the schema, I validated it to make sure. @liberostelios said he will fix this issue soon since the plugin should be able to handle nested attributes. I also listed it as an issue for ninja (#57) since reading them as just a string is perhaps not super useful either.

For now I suggest perhaps un-nesting the attributes and maybe you can instead group them as such: "osm_tags_addr:city", "osm_tags_addr:postcode", etc. This will help if you wish to use them as attributes within QGIS.

I just took a small subset of 5 buildings with cjio and played with attributes manually to check if nesting was the issue. But I think you can easily just change this in your script?

AdrianKriger commented 2 years ago

@Athelena. Lets leave the result as is - I like the nested attributes. It's intuitive. What I will do is add a function that transforms the CItyModel to a "flatter" data-structure; should the user choose.

You have been extremely helpful. Thank you.

Athelena commented 2 years ago

No problem! Always happy to help and it's nice to see people developing open data and open code 😃