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

LoD metadata info for 2nd level objects #107

Open
balazsdukai opened this issue Oct 16, 2021 · 1 comment
Open

LoD metadata info for 2nd level objects #107

balazsdukai opened this issue Oct 16, 2021 · 1 comment
Milestone

Comments

@balazsdukai
Copy link
Member

The cityfeaturemetadata and the presentlods don't have the correct counts with 2nd level object, such as BuildingPart.

Reproduce with multi-lod 3D BAG data:

cjio 3dbag_v210908_fd2cee53_5786.json subset --id "NL.IMBAG.Pand.0518100000285075-0" --id NL.IMBAG.Pand.0518100000285075 save --indent one.json

Then one.json contains:

"cityfeatureMetadata": {
	"Building": {
		"uniqueFeatureCount": 1,
		"aggregateFeatureCount": 1,
		"presentLoDs": {
			"0": 1
		},
		"BuildingParts": 1
	}
},
"presentLoDs": {
	"0": 1
},

This shows that there is only LoD0 in the file. However, the file still had LoD0, 1.2, 1.3, 2.2 for the Building and its BuildingPart.

@LaurensJN
Copy link

I encountered a similar problem that when city_model.update_metadata() is invoked, only LoD0 is added to the PresentLoDs. I think the root of the problem is in the following lines, where all Parts are deleted from the c_o_p list:

c_o_c = [c_o_p.pop(c_o_p.index(x)) for x in c_o_p[:] if any(child in x for child in children)]

Following, only the parent IDs are checked for LoDs, while the LoDs from children are never added to the parents' LoDs:

cjio/cjio/metadata.py

Lines 114 to 126 in d9b4636

for c_o in CityObjects:
cm_type = CityObjects[c_o]["type"]
if cm_type == "CityObjectGroup":
CityObjects_md[cm_type]["uniqueFeatureCount"] += 1
LoD_func()
elif any(child in cm_type for child in children):
CityObjects_md[parent(cm_type)][cm_type+"s"] += 1
else:
CityObjects_md[cm_type]["uniqueFeatureCount"] += 1
CityObjects_md[cm_type]["aggregateFeatureCount"] += len(CityObjects[c_o]["geometry"])
LoD_func()
if cm_type == "TINRelief":
CityObjects_md[cm_type]["triangleCount"] += sum([len(b) for g in CityObjects[c_o]["geometry"] for b in g["boundaries"]])

@balazsdukai balazsdukai added this to the v0.8.0 milestone Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants