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")
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