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

possible to merge cityGml files? #36

Open
pcace opened this issue Jan 12, 2023 · 6 comments
Open

possible to merge cityGml files? #36

pcace opened this issue Jan 12, 2023 · 6 comments

Comments

@pcace
Copy link

pcace commented Jan 12, 2023

Hi,

is there any way to merge cityGML files with citygml-tools? or what would be the way to go here?

Thanks a lot!

@clausnagel
Copy link
Member

Hi @pcace, citygml-tools currently only offers a subset command to create a subset of a CityGML file based on filter criteria. Merging datasets sounds interesting. What would you expect such a command to do? Just create one big file from a list of input files? This would be rather simple to support.

Personally, I would write my own small program with citygml4j to merge files at the moment. Or use a tool like the 3DCityDB to import mutliple files into a database and get whatever I want back out of it. But yes, why not add a merge command to citygml-tools.

@pcace
Copy link
Author

pcace commented Jan 12, 2023

Hi, yes i am looking for a way to simply merge multiple files into one. currently i am trying to merge cityGML tiles to in the end convert them into one glb file. wich kind of works but i keep on messing up the projection and not really know what i am doing wrong. i tried to merge them after converting to cityJson with cjio, but have no luck with the projection (cityjson/cjio#154) so i thought it might be a better solution to do the merging earlier in the process using citygml-tools.
EDIT merging these cityGML files: https://cloud.johannes-froelich.de/s/xtwyW4rrNoeZTE5 with FZKViewer does produce proper results (merging them after converting to cityJson dose not work for some reason):
image

@hugoledoux
Copy link

I would also like to have a merge function as mentioned above: merge all the files into one large files.

More and more cities release their datasets with many many small files with a few buildings, so being able to create a dataset in one shot would be useful.

@hugoledoux
Copy link

hugoledoux commented Apr 16, 2024

I just merged the CityGML LoD3 of Ingolstadt with cjio 'merge' operator and here's the script (mostly because I will remember where to look for it ;))

import os
import glob


#-- citygml-tools
cmd1 = '/Users/hugo/software/citygml-tools-2.3.0/citygml-tools'
cmd2 = 'to-cityjson'

fs = glob.glob('./citygml-dataset/*/*.xml')
for f in fs:
    a = " ".join([cmd1, cmd2, f])
    # print(a)
    os.system(a)

# #-- merge with cjio
fs = glob.glob('./citygml-dataset/*/*.json')
cmd3 = 'cjio'
cmd4 = fs[0]
a = " ".join(['cjio', fs[0], 'merge', "'./citygml-dataset/*/*.json'", 'save', 'merged.city.json'])
os.system(a)

@clausnagel
Copy link
Member

Thanks for your feedback, @hugoledoux. Merging just the XML / JSON is pretty straight-forward, I guess (one might run into duplicate ID issues if the input datasets were created without caring about IDs). But how do you handle texture images and relative paths to those images in your cjio merge operation? Do you leave texture images at their file location and just adapt the relative paths to them? Or do you also merge txture images into a new file location (which would require potentially heavy file copy operations)?

@hugoledoux
Copy link

hmmm, actually I keep the original paths, which is wrong :\ I'll open an issue in cjio.

We offer operators to update the paths of textures, but indeed we should normalise the paths, at least...

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

3 participants