WikimapsAtlas/WikimapsAtlas-generator

Refactor ./script/get_raster_source.bash

hugolpz opened this issue · 1 comments

Use some table such as :

{
  codename: "srtm90" , message: "SRTM90 (1px=90m)"  , dir: "../data/cgiar-csi_90/",
  codename: "srtm250", message: "SRTM250 (1px=250m)", dir: "../data/cgiar-csi_250/",
  codename: "etopo"  , message: "ETOPO (1px = 100m)", dir: "../data/noaa/",
  codename: "test"   , message: "gis raster in ./data/test", dir: "../data/test/"
}

... then loop over it with some :

if [[ ${AREA_SIZE} == "srtm250"  ]]; then
	echo "Source selected: SRTM (1px=250m)"
	files=(`ls ../data/cgiar-csi_250/ | grep .tif$`)
	for i in "${!files[@]}"
	do
		echo "Processing STRM: ${files[${i}]}"
		gdal_translate -projwin $WEST $NORTH $EAST $SOUTH -eco ../data/cgiar-csi_250/${files[${i}]} ./tmp/crop.${i}.tmp.tif
	done
fi
#	inputs=`ls ./tmp/crop.*.tmp.tif | tr '\n' ' '`
#	echo ${inputs}
echo "Merging raw tiles: -----------------------------"
gdal_merge.py -o ./crop_xl_.tmp.tif ./tmp/crop.*.tmp.tif		# -n -32768
gdal_fillnodata.py -md 400 ./crop_xl_.tmp.tif ./crop_xl.tmp.tif
gdal_translate -projwin $WEST $NORTH $EAST $SOUTH -eco ../data/noaa/ETOPO1_Ice_g_geotiff.tif crop_xl_etopo.tmp.tif

Won't do now.