Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ workdir
.DS_Store
docker/*
!docker/docker-compose.custom.yml
.idea
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,9 @@ By executing `export_routing_schema.sh`, a separate routing schema is created
in the database. The data is read from the Digiroad schema and is transformed
into a table structure defined in and used by the JORE4 map-matching backend.
As a result, two database dump files will be created: one in SQL format, named
`digiroad_r_routing_<date>.sql`, and another in PostgreSQL's custom format,
named `digiroad_r_routing_<date>.pgdump`. Both files will be written into
`workdir/pgdump` subdirectory.
`digiroad_r_routing_<digiroad_release>_<date>.sql`, and another in PostgreSQL's
custom format, named `digiroad_r_routing_<digiroad_release>_<date>.pgdump`. Both
files will be written into `workdir/pgdump` subdirectory.

The SQL dump artifact can be uploaded to Azure Blob Storage with the command
below. An active Azure subscription associated with JORE4 is required. Azure CLI
Expand Down Expand Up @@ -241,8 +241,8 @@ run:
```

This command reads selected data items from filtered public transport stop data
imported from Digiroad and writes it to the _workdir/csv/digiroad_stops.csv_
file.
imported from Digiroad and writes it to the
_workdir/csv/digiroad_stops_<digiroad_version>.csv_ file.

## Exporting vector tiles

Expand Down
2 changes: 1 addition & 1 deletion create_qgis_project_archive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ source "$(dirname "$0")/set_env.sh"
# Create a zip archive containing HSL QGIS fixup project.
mkdir -p "$WORK_DIR"/zip

zip -r "${WORK_DIR}/zip/$(date "+%Y-%m-%d")_hsl_qgis_fixup_project.zip" \
zip -r "${WORK_DIR}/zip/${DIGIROAD_IRROTUS_NRO}_$(date "+%Y-%m-%d")_hsl_qgis_fixup_project.zip" \
fixup/jore4-digiroad-fix-project.qgz \
fixup/digiroad workdir/shp/UUSIMAA/
2 changes: 1 addition & 1 deletion export_infra_network_csv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ source "$(dirname "$0")/set_env.sh"
docker_start

# Export CSV file to output directory.
OUTPUT_FILENAME="infra_network_digiroad.csv"
OUTPUT_FILENAME="infra_network_digiroad_${DIGIROAD_IRROTUS_NRO}.csv"

mkdir -p "${WORK_DIR}/csv"

Expand Down
4 changes: 2 additions & 2 deletions export_mbtiles_dr_linkki.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ source "$(dirname "$0")/set_env.sh"

DB_TABLE_NAME="dr_linkki"

MBTILES_MAX_ZOOM_LEVEL=16
MBTILES_MAX_ZOOM_LEVEL=17
MBTILES_LAYER_NAME=$DB_TABLE_NAME
MBTILES_DESCRIPTION="Digiroad road links"

Expand All @@ -19,7 +19,7 @@ GEOJSON_OUTPUT_DIR="${MBTILES_OUTPUT_DIR}/geojson_input"
mkdir -p "$SHP_OUTPUT_DIR"
mkdir -p "$GEOJSON_OUTPUT_DIR"

OUTPUT_FILE_BASENAME="${DB_TABLE_NAME}_$(date "+%Y-%m-%d")"
OUTPUT_FILE_BASENAME="${DB_TABLE_NAME}_${DIGIROAD_IRROTUS_NRO}_$(date "+%Y-%m-%d")"

SHP_OUTPUT_FILE="${OUTPUT_FILE_BASENAME}.shp"
GEOJSON_OUTPUT_FILE="${OUTPUT_FILE_BASENAME}.geojson"
Expand Down
2 changes: 1 addition & 1 deletion export_mbtiles_dr_pysakki.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ GEOJSON_OUTPUT_DIR="${MBTILES_OUTPUT_DIR}/geojson_input"
mkdir -p "$SHP_OUTPUT_DIR"
mkdir -p "$GEOJSON_OUTPUT_DIR"

OUTPUT_FILE_BASENAME="${DB_TABLE_NAME}_$(date "+%Y-%m-%d")"
OUTPUT_FILE_BASENAME="${DB_TABLE_NAME}_${DIGIROAD_IRROTUS_NRO}_$(date "+%Y-%m-%d")"

SHP_OUTPUT_FILE="${OUTPUT_FILE_BASENAME}.shp"
GEOJSON_OUTPUT_FILE="${OUTPUT_FILE_BASENAME}.geojson"
Expand Down
2 changes: 1 addition & 1 deletion export_pgdump_digiroad.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ source "$(dirname "$0")/set_env.sh"
# Start Docker container. The container is expected to exist and contain all the data to be exported.
docker_start

PGDUMP_OUTPUT="digiroad_r_$(date "+%Y-%m-%d").pgdump"
PGDUMP_OUTPUT="digiroad_r_${DIGIROAD_IRROTUS_NRO}_$(date "+%Y-%m-%d").pgdump"
OUTPUT_TABLES="dr_linkki dr_pysakki dr_kaantymisrajoitus"
OUTPUT_TABLE_OPTIONS=$(echo "${OUTPUT_TABLES[@]}" | sed "s/dr_/-t ${DB_SCHEMA_NAME_DIGIROAD}.dr_/g")

Expand Down
2 changes: 1 addition & 1 deletion export_stops_csv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ source "$(dirname "$0")/set_env.sh"
docker_start

# Export csv file to output directory.
OUTPUT_FILENAME="digiroad_stops.csv"
OUTPUT_FILENAME="digiroad_stops_${DIGIROAD_IRROTUS_NRO}.csv"

mkdir -p "$WORK_DIR"/csv

Expand Down
2 changes: 1 addition & 1 deletion generate_fixup_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ source "$CWD"/set_env.sh
docker_start

# Generate HSL supplementary links and stop points.
docker_exec postgres "exec $PSQL -v ON_ERROR_STOP=1 -f /tmp/sql/add_hsl_fixup_data_for_dr_2025_02.sql -v schema=$DB_SCHEMA_NAME_DIGIROAD"
docker_exec postgres "exec $PSQL -v ON_ERROR_STOP=1 -f /tmp/sql/add_hsl_fixup_data_for_dr_${DIGIROAD_IRROTUS_NRO}.sql -v schema=$DB_SCHEMA_NAME_DIGIROAD"

# Rewrite the GeoPackage file containing HSL's infrastructure network
# supplementing data.
Expand Down
7 changes: 7 additions & 0 deletions import_digiroad_shapefiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ source "$(dirname "$0")/set_env.sh"
AREA="UUSIMAA"

SHP_URL="https://aineistot.vayla.fi/?path=ava/Tie/Digiroad/Aineistojulkaisut/latest/Maakuntajako_digiroad_R/${AREA}.zip"
IRROTUS_NRO_URL="https://aineistot.vayla.fi/?path=ava/Tie/Digiroad/Aineistojulkaisut/latest/irrotus_nro.txt"

DOWNLOAD_TARGET_DIR="${WORK_DIR}/zip"
DOWNLOAD_TARGET_FILE="${DOWNLOAD_TARGET_DIR}/${AREA}_R.zip"
Expand All @@ -17,6 +18,12 @@ DOWNLOAD_TARGET_FILE="${DOWNLOAD_TARGET_DIR}/${AREA}_R.zip"
if [[ ! -f "$DOWNLOAD_TARGET_FILE" ]]; then
mkdir -p "$DOWNLOAD_TARGET_DIR"
curl -Lo "$DOWNLOAD_TARGET_FILE" "$SHP_URL"

DIGIROAD_IRROTUS_NRO=$(curl -sL "$IRROTUS_NRO_URL")
if [[ ! -f "${DOWNLOAD_TARGET_DIR}/digiroad_${DIGIROAD_IRROTUS_NRO}.txt" ]]; then
echo $DIGIROAD_IRROTUS_NRO > "${DOWNLOAD_TARGET_DIR}/digiroad_${DIGIROAD_IRROTUS_NRO}.txt"
fi
echo $DIGIROAD_IRROTUS_NRO >| "${DOWNLOAD_TARGET_DIR}/digiroad_irrotus_nro.txt"
fi

SUB_AREAS="ITA-UUSIMAA UUSIMAA_1 UUSIMAA_2"
Expand Down
2 changes: 1 addition & 1 deletion import_infra_network_csv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ PGPASSWORD="${PGPASSWORD:-adminpassword}"
source "$(dirname "$0")/set_env.sh"

# Import dump from csv file.
INPUT_FILENAME="infra_network_digiroad.csv"
INPUT_FILENAME="infra_network_digiroad_${DIGIROAD_IRROTUS_NRO}.csv"
PGPASSWORD="$PGPASSWORD" psql -h "$PGHOSTNAME" -p "$PGPORT" -U "$PGUSERNAME" -d "$PGDATABASE" \
-v ON_ERROR_STOP=1 -f "$CWD"/sql/import_infra_links_from_csv.sql -v csvfile="${WORK_DIR}/csv/${INPUT_FILENAME}"
5 changes: 5 additions & 0 deletions set_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ CWD="$(dirname "$0")"
export CWD
export WORK_DIR="${CWD}/workdir"

export DIGIROAD_IRROTUS_NRO=""
if [[ -f "$WORK_DIR/zip/digiroad_irrotus_nro.txt" ]]; then
DIGIROAD_IRROTUS_NRO=$(cat "$WORK_DIR/zip/digiroad_irrotus_nro.txt")
fi

# shapefile encoding
export SHP_ENCODING="UTF-8"

Expand Down
2 changes: 1 addition & 1 deletion upload_routing_dump_to_azure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# NB: Not all versions of Azure CLI seem to work for uploading the files, see the error message below for more info.

# The target file is an SQL dump file for routing schema for current date.
SQL_FILE="./workdir/pgdump/digiroad_r_routing_$(date "+%Y-%m-%d").sql"
SQL_FILE="./workdir/pgdump/digiroad_r_routing_${DIGIROAD_IRROTUS_NRO}_$(date "+%Y-%m-%d").sql"

if [[ ! -f "${SQL_FILE}" ]]; then
echo "File to upload does not exist: ${SQL_FILE}"
Expand Down