Skip already existing file

This commit is contained in:
yvecai 2012-10-21 23:09:25 +02:00
parent 39417c8afa
commit 8d62591928

View file

@ -39,19 +39,23 @@ outfile=$outdir$fileroot.osm
# ---------------------------------------------
# process
# ---------------------------------------------
echo "----------------------------------------------"
echo "Processing"$fileroot
echo "----------------------------------------------"
echo "Extracting shapefile …"
if [ -f ${TMP_DIR}tmp.shp ]; then rm ${TMP_DIR}tmp.shp ${TMP_DIR}tmp.dbf ${TMP_DIR}tmp.prj ${TMP_DIR}tmp.shx; fi
gdal_contour -i 10 -snodata -32768 -a height $infile ${TMP_DIR}tmp.shp
if [ $? -ne 0 ]; then echo $(date)' Error creating shapefile' & exit 4;fi
if [ ! -f $outfile ]
then
echo "----------------------------------------------"
echo "Processing"$fileroot
echo "----------------------------------------------"
echo "Extracting shapefile …"
if [ -f ${TMP_DIR}tmp.shp ]; then rm ${TMP_DIR}tmp.shp ${TMP_DIR}tmp.dbf ${TMP_DIR}tmp.prj ${TMP_DIR}tmp.shx; fi
gdal_contour -i 10 -snodata -32768 -a height $infile ${TMP_DIR}tmp.shp
if [ $? -ne 0 ]; then echo $(date)' Error creating shapefile' & exit 4;fi
echo "Building osm file …"
${working_dir}/srtmshp2osm.py -q -f $TMP_DIR/tmp.shp -o $outfile
if [ $? -ne 0 ]; then echo $(date)' Error creating OSM file' & exit 5;fi
echo "Compressing to osm.bz2 …"
bzip2 -f $outfile
if [ $? -ne 0 ]; then echo $(date)' Error compressing OSM file' & exit 6;fi
echo "Building osm file …"
${working_dir}/srtmshp2osm.py -q -f $TMP_DIR/tmp.shp -o $outfile
if [ $? -ne 0 ]; then echo $(date)' Error creating OSM file' & exit 5;fi
echo "Compressing to osm.bz2 …"
bzip2 -f $outfile
if [ $? -ne 0 ]; then echo $(date)' Error compressing OSM file' & exit 6;fi
else
echo "Skipping, already existing file"
fi