-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
29 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,26 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
cd /data | ||
|
||
curl ${CQLP_API}/api/etablissements >etablissements.json | ||
|
||
mkdir -p isochrones | ||
|
||
# Create isochrones scripts | ||
readonly GRAPHHOPPER_URL=$GRAPHHOPPER_URL | ||
readonly ISOCHRONE_DATE=$ISOCHRONE_DATE | ||
readonly ISOCHRONE_PARALLEL=$ISOCHRONE_PARALLEL | ||
readonly GRAPHHOPPER_PROFILE=${1:?"Merci de préciser un profil (ex: pt ou bike)"} | ||
|
||
shift | ||
|
||
TIMES=(5400 3600 2700 1800 900) | ||
for TIME in ${TIMES[@]}; do | ||
mkdir -p isochrones/${GRAPHHOPPER_PROFILE}/${TIME} | ||
jq --raw-output '.[] | select(.latitude!=null)| "\(.uai),\(.latitude),\(.longitude)"' etablissements.json | | ||
awk -F, -v GRAPHHOPPER_PROFILE="$GRAPHHOPPER_PROFILE" -v GRAPHHOPPER_URL="$GRAPHHOPPER_URL" -v DATE="$ISOCHRONE_DATE" -v TIME="$TIME" '{print "curl \""GRAPHHOPPER_URL"/isochrone?point="$2","$3"&profile="GRAPHHOPPER_PROFILE"&pt.earliest_departure_time="DATE"&time_limit="TIME"&buckets=1&result=multipolygon&reverse_flow=true\" > isochrones/"GRAPHHOPPER_PROFILE"/"TIME"/"$1".json"}' >liste_${GRAPHHOPPER_PROFILE}_${TIME} | ||
jq --raw-output '.[] | select(.latitude!=null)| "\(.uai) \(.latitude) \(.longitude)"' etablissements.json | | ||
awk -F, -v GRAPHHOPPER_PROFILE="$GRAPHHOPPER_PROFILE" -v DATE="$ISOCHRONE_DATE" -v TIME="$TIME" '{print GRAPHHOPPER_PROFILE" "DATE" "TIME" "$1" "$2" "$3}' >liste_${GRAPHHOPPER_PROFILE}_${TIME} | ||
done | ||
|
||
# Get isochrones | ||
for TIME in ${TIMES[@]}; do | ||
parallel -j $ISOCHRONE_PARALLEL bash -c "{}" <liste_${GRAPHHOPPER_PROFILE}_${TIME} | ||
cat liste_${GRAPHHOPPER_PROFILE}_${TIME} | parallel --colsep ' ' --halt-on-error now,fail=1 -j $ISOCHRONE_PARALLEL bash isochrone.sh {1} {2} {3} {4} {5} {6} | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
readonly GRAPHHOPPER_URL=$GRAPHHOPPER_URL | ||
readonly ISOCHRONE_DATE=$ISOCHRONE_DATE | ||
readonly ISOCHRONE_PARALLEL=$ISOCHRONE_PARALLEL | ||
readonly GRAPHHOPPER_PROFILE=${1:?"Merci de préciser un profil (ex: pt ou bike)"} | ||
readonly DATE=${2:?"Merci de préciser une date"} | ||
readonly TIME=${3:?"Merci de préciser un durée"} | ||
readonly UAI=${4:?"Merci de préciser un uai"} | ||
readonly LATITUDE=${5:?"Merci de préciser une latitude"} | ||
readonly LONGITUDE=${6:?"Merci de préciser une longitude"} | ||
readonly RESULT_FILE="done_${GRAPHHOPPER_PROFILE}_${TIME}" | ||
|
||
mkdir -p isochrones/${GRAPHHOPPER_PROFILE}/${TIME} | ||
|
||
curl --no-progress-meter "${GRAPHHOPPER_URL}/isochrone?point=${LATITUDE},${LONGITUDE}&profile=${GRAPHHOPPER_PROFILE}&pt.earliest_departure_time=${DATE}&time_limit=${TIME}&buckets=1&result=multipolygon&reverse_flow=true" >isochrones/${GRAPHHOPPER_PROFILE}/${TIME}/${UAI}.json | ||
echo "done: ${UAI}" >>${RESULT_FILE} |