Skip to content

Instantly share code, notes, and snippets.

@gadomski
Created January 13, 2017 15:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gadomski/44783981576a3de589a206deb319b79a to your computer and use it in GitHub Desktop.
Save gadomski/44783981576a3de589a206deb319b79a to your computer and use it in GitHub Desktop.
Using a docker image to run `pdal translate` without having to specify volume paths
#!/usr/bin/env sh
set -e
docker_image=gadomski/magic-bucket
realpath() {
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
}
if [[ ! -e $1 ]]; then
echo "ERROR: infile $1 does not exist"
exit 1
fi
infile=`realpath "$1"`
volume1=`dirname "$infile"`
infilename="${infile##*/}"
shift
if [[ -z $1 ]]; then
echo "ERROR: outfile $1 is empty"
exit 1
fi
outfile=`realpath "$1"`
volume2=`dirname "$outfile"`
outfilename="${outfile##*/}"
shift
docker run --rm -v $volume1:/volume1 -v $volume2:/volume2 $docker_image pdal translate /volume1/$infilename /volume2/$outfilename $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment