Skip to content

Latest commit

 

History

History
92 lines (54 loc) · 3.18 KB

installation.md

File metadata and controls

92 lines (54 loc) · 3.18 KB

Installation

The code is based on a combination of Python and SQL scripts.

To run the code, first install the required dependencies:

1. Clone the GitHub repository

First clone this repository (recommended) to your local machine or download it.

To avoid cloning the history and larger branches with example data and plots, use:

git clone -b main --single-branch [url to GitHub repository] --depth 1

2. Install Postgresql

Install Postgresql version 14.10 or newer.

See this link for a guide to installing Postgresql with homebrew on Mac.

PgAdmin is not required, but can be useful when inspecting the results: Guide for installing PgAdmin.

3. Install PostGIS and PgRouting

Install the Postgresql extensions PostGIS and PgRouting.

If using homebrew, once Postgresql is installed, run:

brew install postgis

brew install pqrouting

4. Install osm2pgsql

osm2pgsql is used to load OSM to Postgresql with all desired OSM tags.

On Mac, osm2pgsql can be installed by running:

brew install osm2pgsql

5. Install osm2po

osm2po is used for loading OSM data to Postgresql in a format compatible with PgRouting.

The necessary files are already included in this repository. If a newer version is needed, replace the content in the folder osm2po. (See e.g. this link for an installation guide.)

If a newer version is used, once installed, replace the osm2po.config file with the one included on this repository.

6. Install GDAL

Used for loading the GeoDanmark geopackage to PostgreSQL.

On mac, run:

brew install gdal

7. Create conda environment

To ensure that all packages needed for the analysis are installed, it is recommended to create and activate a new conda environment using the environment.yml:

conda env create --file=environment.yml
conda activate dk_network_analysis

If this fails, the environment can be created by running:

conda config --prepend channels conda-forge
conda create -n dk_network_analysis --strict-channel-priority geopandas seaborn psycopg2 contextily matplotlib-scalebar sqlalchemy geoalchemy2 pyarrow h3-py pyyaml pysal plotly plotly_express==0.4.0 numba rioxarray rasterio ipykernel

When the environment has been created successfully, run:

pip install kaleido
pip install --upgrade nbformat

8. Install src package

The repository has been set up using the structure described in the Good Research Developer. Once the repository has been downloaded, activate the dk_bike_network environment, navigate to the main folder in a terminal window and run the commands:

conda activate dk_bike_network
conda install pip
pip install -e .