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

conversion --ignore_duplicated_keys doesn't work. #3

Open
ger08061959 opened this issue May 18, 2024 · 3 comments
Open

conversion --ignore_duplicated_keys doesn't work. #3

ger08061959 opened this issue May 18, 2024 · 3 comments

Comments

@ger08061959
Copy link

Option doesn't work. One has to delete the double keys from the jsonl file generated

@balazsdukai
Copy link
Contributor

Hi, please provide the full command and a small amount of your input data to reproduce the issue.

@ger08061959
Copy link
Author

First empty record with metadata and empty fields cityobjects. Attached to it again a json record with cityobjects , now with filled cityobjects. using option --ignore_duplicated_keys is not ignoring the first or second mentioning of the key.

"metadata": {
    "referenceSystem": "https://www.opengis.net/def/crs/EPSG/0/7415"
},
"CityObjects": {}
"transform": {
    "scale": [
        0.001,
        0.001,
        0.001
    ],
    "translate": [
        157650.12575,
        571493.0715,
        0.05200005340576119
    ]
},
"type": "CityJSON",
"version": "2.0",
"CityObjects": {
    "NL.IMBAG.Pand.0710100000151707": {
        "attributes": {
     ...

change the file generating code from sample to replace the the fields in the initial section to

        jcUrl = 'https://api.3dbag.nl/collections/pand/items/NL.IMBAG.Pand.'+str(self.site.getBAGPandidentificatie())
        with urllib.request.urlopen(jcUrl) as response:
            if response.code == 200:
                j = json.loads(response.read().decode('utf-8'))
                j_meta = j["metadata"]
                if "feature" in j:
                    j_city = j["feature"]
                    # move correct data in place
                    j_meta['CityObjects'] = j_city['CityObjects']
                    j_meta['vertices'] = j_city['vertices']
                with open(self.IFCModelDict, "w") as my_file:
                    my_file.write(json.dumps(j_meta, indent=4) + "\n")
            else:
                self.logger.logger.error(f'Invalid response code {response.code}')

@ger08061959
Copy link
Author

call to cityjson...
# call convert
path_to_convert_dir = PATHToCityJSON2IFC
self.outputIfc = self.site.getAddress()+'.ifc'
cmd = [os.path.join(path_to_convert_dir, 'cityjson2ifc'),
'--lod-split',
self.IFCModelDict,
self.outputIfc]
result = subprocess.run(cmd)

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