Skip to content

Commit

Permalink
Fix loop for non-bash shells
Browse files Browse the repository at this point in the history
  • Loading branch information
jstcki committed Nov 5, 2013
1 parent fc701d0 commit 51094a5
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -178,27 +178,24 @@ shp/ch/contours.shp: shp/ch/contours-unclipped.shp shp/ch/country.shp
shp/ch/contours-unclipped.shp: shp/ch/contours_$(CONTOUR_INTERVAL).shp
mkdir -p $(dir $@)
ogr2ogr -nlt POLYGON $@ $(dir $<)contours_0.shp
i=$(CONTOUR_INTERVAL); while [ $$i -lt 4446 ]; do \
for i in `seq $(CONTOUR_INTERVAL) $(CONTOUR_INTERVAL) 4445`; do \
ogr2ogr -update -append -nln contours-unclipped -nlt POLYGON $@ $(dir $<)contours_$$i.shp; \
((i = i + $(CONTOUR_INTERVAL))); \
done

tif/contours/contours_$(CONTOUR_INTERVAL).tif: tif/srtm/srtm.tif
mkdir -p $(dir $@)
i=0; while [ $$i -lt 4446 ]; do \
for i in `seq 0 $(CONTOUR_INTERVAL) 4445`; do \
if [ $$i = 0 ]; then \
gdal_calc.py -A $< --outfile=$(dir $@)contours_$$i.tif --calc="0" --NoDataValue=-1; \
else \
gdal_calc.py -A $< --outfile=$(dir $@)contours_$$i.tif --calc="$$i*(A>$$i)" --NoDataValue=0; \
fi; \
((i = i + $(CONTOUR_INTERVAL))); \
done

shp/ch/contours_$(CONTOUR_INTERVAL).shp: tif/contours/contours_$(CONTOUR_INTERVAL).tif
mkdir -p $(dir $@)
i=0; while [ $$i -lt 4446 ]; do \
for i in `seq 0 $(CONTOUR_INTERVAL) 4445`; do \
gdal_polygonize.py -f "ESRI Shapefile" tif/contours/contours_$$i.tif $(dir $@)contours_$$i.shp contours_$$i elev; \
((i = i + $(CONTOUR_INTERVAL))); \
done

##################################################
Expand Down

0 comments on commit 51094a5

Please sign in to comment.