3DGI / cityjson2ifc

A command line tool for converting CityJSON files to IFC format
GNU Lesser General Public License v3.0
4 stars 0 forks source link

dumping as jsonl file gives error #4

Open ger08061959 opened 1 month ago

ger08061959 commented 1 month ago

When metadata is written it enters empty Objects. Those clash with the added feature(s), ignore duplicated does not remove empty fields { "CityObjects": {}, // duplicate field in next record "metadata": { "referenceSystem": "https://www.opengis.net/def/crs/EPSG/0/7415" }, "transform": { "scale": [ 0.001, 0.001, 0.001 ], "translate": [ 157560.28575, 571353.4415, 0.9310000534057608 ] }, "type": "CityJSON", duplicated field at end as type: CityJSONFeatures "version": "2.0", "vertices": [] duplicated field } next record ignored as faulty { "CityObjects": { Duplicate "NL.IMBAG.Pand.0710100000152165": {

Adaption of code to write either feature or features but not both

        with urllib.request.urlopen(jcUrl) as response:
            if response.code == 200:
                j = json.loads(response.read().decode('utf-8'))
                with open(self.IFCModelDict, "w") as my_file:
                    my_file.write(json.dumps(j["metadata"], indent=4) + "\n")
                    if "feature" in j:
                        my_file.write(json.dumps(j["feature"], indent=4) + "\n")
                    elif "features" in j:
                        for f in j["features"]:
                            my_file.write(json.dumps(f, indent=4) + "\n")
balazsdukai commented 1 month ago

Hi, could explain your workflow in more detail? Also, please provide the full command and a small amount of your input data to reproduce the issue.