# Cityblocks

Python utility to:

- Download global LCZ map from [Demuzere et al.](https://zenodo.org/records/7670653).
- Extract an area of interest
- Generate a new dataset where each pixel is replaced by a 2D tile corresponding to the LCZ type

The generated file can be displayed in QGIS to create stunning visualizations in 3D.

## How to use

```sh
# Install the tool
pip install git+https://github.com/Urban-M4/cityblocks.git

# Download global LCZ data. 
cityblocks download

# Extract area of interest
cityblocks extract "4.724808,52.273620,5.182114,52.458729"

# Convert LCZ data to 2d tiles
cityblocks convert
```

Data is downloaded in folder where the command is executed.


## QGIS styling
Then, import the dataset in QGIS and visualize it. We created a QGIS styling file [cityblocks_LCZ.qml](qgis_files/cityblocks_LCZ.qml), which you can load as follows:

1. Load layer in [QGIS](https://qgis.org/) (we used 3.34.8 LTR)
![Load layer in QGIS](images/1.png)

2. Go to properties:
![Go to properties](images/2.png)

3. Load Style from [cityblocks_LCZ.qml](\qgis_files\cityblocks_LCZ.qml) 
![Load style](images/3.png) 

4. You can modify the style as you like 
![modify the style](images/4.png)

5. Create a 3D map view
![Create a 3D map view](images/5.png)

6. Browse through you Local Climate Zones Cityblocks!
![Go to properties](images/6.png)

Note that you can add styled 2D layers in your QGIS environment to show them in your 3D render.


## Example output

The file generated by the cityblocks command line utility looks like this when imported in QGIS.

![2d version of LCZ tiles](images/Amsterdam_2D.png)

By extruding the surface and applying a bit of styling, we can generate images like below:

![3d version of LCZ tiles](images/Amsterdam_3D.png)

The tiles can also be combined with other map layers:

![3d tiles with background image](images/Amsterdam_3D_bg.png)
