Skip to content

Commit

Permalink
Remove unused createBuildings.sh and getFilteredPbf.sh and revert cha…
Browse files Browse the repository at this point in the history
…nges to getSource.sh to be in sync with upstream
  • Loading branch information
DavidKarlas committed Aug 19, 2023
1 parent 61bae1e commit 5f8b6e5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 99 deletions.
25 changes: 0 additions & 25 deletions createBuildings.sh

This file was deleted.

54 changes: 0 additions & 54 deletions getFilteredPbf.sh

This file was deleted.

30 changes: 10 additions & 20 deletions getSource.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ TempDest="${2}"
credentialsFile="CREDENTIALS-egp.gu.gov.si.txt"
maxAge=720
baseUrl="https://egp.gu.gov.si/egp/"
files=("RPE_PE.ZIP" "RPE_UL.ZIP" "RPE_HS.ZIP" "KS_SLO_CSV_A_U.zip" "KS_SLO_SHP_G.zip")
#files=("RPE_PE.ZIP" "RPE_UL.ZIP" "RPE_HS.ZIP" "KS_SLO_CSV_A_U.zip" "KS_SLO_SHP_G.zip" "ko_zk_slo.zip")

SEDCMD="sed"
STATCMD="stat"
Expand All @@ -24,29 +22,27 @@ esac
echo Running on: "${machine}", using $SEDCMD and $STATCMD commands

function extractDownloaded() {
mkdir -p "${TempDest}"
#----- extract: -------
for file in "${DownloadDest}"*.{zip,ZIP}; do
for file in "${DownloadDest}"RPE_*.ZIP; do
extdir=$(basename "$file" .ZIP)
extdir=$(basename "$extdir" .zip)
echo "$extdir"
unzip -o -d "${TempDest}$extdir" "$file"
done
for file in "${TempDest}"RPE_*/*.zip; do unzip -o -d "${TempDest}" "$file"; done

#unzip -o -d "${dest}/ko_zk_slo" "${DownloadDest}ko_zk_slo.zip"

$STATCMD -c '%y' "${TempDest}HS/HS.shp" | cut -d' ' -f1 >"${TempDest}timestamp.txt"
}

countTooOld=${#files[@]}
countTooOld=3

for filename in "${files[@]}"; do
fullfilename="${DownloadDest}${filename}"
if [ -f "$fullfilename" ]; then
if [ $(find "${fullfilename}" -mmin -${maxAge} | wc -l) -gt "0" ]; then
countTooOld=$((countTooOld-1))
fi
fi
done
#if [ -f "${DownloadDest}RPE_PE.ZIP" -a -f "${DownloadDest}RPE_UL.ZIP" -a -f "${DownloadDest}RPE_HS.ZIP" -a -f "${DownloadDest}ko_zk_slo.zip" ] ; then
if [ -f "${DownloadDest}RPE_PE.ZIP" ] && [ -f "${DownloadDest}RPE_UL.ZIP" ] && [ -f "${DownloadDest}RPE_HS.ZIP" ]; then
#check age of existing files
#countTooOld=`find ${DownloadDest}RPE_PE.ZIP ${DownloadDest}RPE_UL.ZIP ${DownloadDest}RPE_HS.ZIP ${DownloadDest}ko_zk_slo.zip -mmin +${maxAge} | wc -l`
countTooOld=$(find "${DownloadDest}RPE_PE.ZIP" "${DownloadDest}RPE_UL.ZIP" "${DownloadDest}RPE_HS.ZIP" -mmin +${maxAge} | wc -l)
fi

# exit if all are newer than max age
if [ "$countTooOld" -gt "0" ]; then
Expand Down Expand Up @@ -148,12 +144,6 @@ downloadFile 106
#RPE_HS.ZIP
downloadFile 107

#KS_SLO_SHP_G.zip
downloadFile 191

#KS_SLO_CSV_A_U.zip, calling wget dirrectly because different format and d96
wget "${commonWgetParams[@]}" --content-disposition -N "${baseUrl}download-file.html?id=192&format=50&d96=4"

#ko_zk_slo.zip
#downloadFile 108

Expand Down

0 comments on commit 5f8b6e5

Please sign in to comment.