Three options:
- You can use
pip install -r requirements.txtinto a virtual environment, - If you have
uvinstalled, runuv syncto get the the environment and dependencies installed at once - If you have
dockerand thecomposeplugin, rundocker compose buildto create a local image with the dependencies ready
The main.py script does the following:
- Downloads from CartoCiudad the geopackages for the three Valencian provinces into a
data/provincesfolder - From each geopackage, extracts all the different street number points into CSVs per postcode into the folders
data/postcodes/[alicante|castellon|valencia]. - Then for each postcode CSV it computes the centroid following these steps:
- Compute a
DBSCANclustering using the parameters indcac_postcodes/config.py - From the clusters that are not considered noise, compute the center and the closest point in the original dataset
- Return the largest along with the number of points considered and their percentage
- Store the result in
data/postcodes.csv
- Compute a
The script is documented and running main.py -h will provide the settings available to change log level, force downloads, etc.
To use the docker recipe, just run docker compose run postcodes with the same options (so probably start with --help).