Open rob-scholten95 opened 5 months ago
It's loaded but it's not printed by that function.
If you do this you should see it:
print(cityjson_cm.transform)
See there how to use it: https://cjio.readthedocs.io/en/latest/api_tutorial_basics.html#Geometry-boundaries-and-Semantic-Surfaces
Hope this helps
Hey!
thanks for your help! I can now see the 'transform' information using the solution you proposed. I still can't get it to work properly when trying to merge the different tiles together using merge().
def merge_city_json(filenames):
cms = []
cm = cityjson.load(filenames[0], transform=True)
print(f"Loaded a citymodel with {len(cm.cityobjects)} CityObjects")
for p in filenames[1:]:
_cm = cityjson.load(p, transform=True)
cms.append(_cm)
print(f"Loaded a citymodel with {len(_cm.cityobjects)} CityObjects")
cm.merge(cms)
it results in this error:
Python: Traceback (most recent call last):
File "F:\Projects\00_Documents\JSON\JSON import using python4.1.blend\Text", line 247, in <module>
File "F:\Projects\00_Documents\JSON\JSON import using python4.1.blend\Text", line 245, in main
File "F:\Projects\00_Documents\JSON\JSON import using python4.1.blend\Text", line 172, in merge_city_json
File "C:\Users\Rob\AppData\Roaming\Python\Python311\site-packages\cjio\cityjson.py", line 1263, in merge
imp_digits = math.ceil(abs(math.log(self.j["transform"]["scale"][0], 10)))
~~~~~~^^^^^^^^^^^^^
KeyError: 'transform'
Still trying to figure this out. On my work machine it works flawlessly, but on my personal machine it always stops with this error. I have double checked the versions and have made multiple venv's with the requirements.txt from my work PC's venv. Anyone any clue?
Hi @rob-scholten95 , could you try:
def merge_city_json(filenames):
cms = []
cm = cityjson.load(filenames[0], transform=False)
print(f"Loaded a citymodel with {len(cm.cityobjects)} CityObjects")
for p in filenames[1:]:
_cm = cityjson.load(p, transform=True)
cms.append(_cm)
print(f"Loaded a citymodel with {len(_cm.cityobjects)} CityObjects")
cm.merge(cms)
You'll find some more material here: https://github.com/3DGI/3dbag-workshop-foss4gnl2021 . The workshop explains how the different parts of cjio work together at the moment.
I have been trying to merge four tiles, downloaded through WFS in Blender:
3DBAG tiles: ['9/248/576', '9/248/580', '9/252/576', '9/252/580']
The code i use for loading in the file to be read:
Now, in this file, I have verified multiple times that there is no "transform" key in the file. Now when I load it in as an normal JSON,
the 'transform' key does exist. The key also exists when I download the tile from the WFS service:
This is the output:
of this code:
this is the collapsed structure of the downloaded JSON file, where the transform key is visible:
I am probably missing something, but i am desperate. Any help would be greatly appreciated!