For a given city, perform the following steps:
- If the city is in the US, use the census tracts. Open QGIS and load census tracts of state from
data/0_boundaries/0_Census
. Select and save polygons for the city into a geopackage indata/0_boundaries/[city]/[city].gpkg
. - If the city is not in the US, get the boundaries from OSM. Add a list of cities into a text file and include the filepath in
config.py
. Then runpython run.py boundaries
. If the script fails to retrieve boundaries, download them directly from Overpass Turbo and save them intodata/0_boundaries/[city]/[city].gpkg
.
If you use QGIS to edit the boundaries save the QGIS file into data/3_QGIS/[city].qgz
for step 3.
- Edit
config.py
and run the script withpython run.py
or any option described in the sectionDocker
below. The output will be stored indata/1_buildings_streets
anddata/2_morphometrics
.
- Load the boundaries in
data/0_boundaries/[city]/[city].gpkg
into QGIS and add aDark Matter (retina)
layer. Save the file intodata/3_QGIS/[city].qgz
if it does not exist. - In the QGIS Python Editor, run
0_load_layers.py
. - Reclassify all layers: for each morphometrics layer, go to Properties>Symbology and click Delete All, then Classify.
- Open map layout and check it looks good, set scale to round numbers.
- In the QGIS Python Editor, run
1_export_images.py
.
All images are exported into figs/[city]/[city].jpg
.
To use a docker image with all required packages:
make docker
To open a shell inside the container:
make shell
To run, edit config.py
and run python run.py
or add command line arguments.
Outside the container, edit config.py
and run:
make run
make run cmd="'Buenos Aires'"
make run cmd="data/cities_us.txt start 'New York'"
You can use command line arguments directly to run a list of cities:
python run.py "New York" "Los Angeles"
You can also provide a text file and a starting point:
python run.py data/cities_us.txt start "New York"
pytest
New York City Boroughs: NYC Open Data Portal