Python CityJSON io, editor and modeling library
Loading a file :
import pycityjson.io as cjio
import pycityjson.model as cj
city = cjio.read('railway.city.json')
Selecting an object :
# SolitaryVegetationObject with GeometryInstance
uuid = 'GMLID_SO0286258_965_2893'
cityobject = city[uuid]
Applying a transformation on an object :
matrix = cj.TransformationMatrix().translate((0, 0, 12))
cityobject.transform(matrix)
Saving the modified CityJSON file :
cjio.write_as_cityjson(city, 'railway_modified.city.json', pretty=False, purge_vertices=True)
Saving the modified CityJSON to wavefront :
cjio.write_as_wavefront(city, 'railway_modified.obj', as_one_geometry=False, swap_yz=True)
https://www.cityjson.org/specs/2.0.1/
https://www.cityjson.org/datasets/
ruff check --fix .
ruff format .