Demo: View CityJSON¶
This demo illustrates how to load and view a CityJSON city model.
To run the demo, type:
$ python view_cityjson.py
Purpose¶
This demo demonstrates how to download a CityJSON file from an external URL, load the city model from the file, and visualize it using the DTCC platform.
Step-by-step¶
Download CityJSON File: Retrieve a CityJSON file from a specified URL. This file contains the city model data in the CityJSON format.
from urllib.request import urlretrieve url = "https://3d.bk.tudelft.nl/opendata/cityjson/3dcities/v2.0/DenHaag_01.city.json" urlretrieve(url=url, filename="city.json")
Load City Model: Use the
load_city
function provided by DTCC to load the city model from the downloaded CityJSON file.import dtcc city = dtcc.load_city("city.json")
View the City Model: Visualize the loaded city model by invoking its
view()
method.city.view()
Complete Code¶
Below is the complete code for this demo:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
|