WikimapsAtlas / WikimapsAtlas-generator

A command line utility to convert heavy GIS sources into elegant administrative & topographic topojson files, raster files, and web friendly svg maps.
MIT License
45 stars 6 forks source link

Refactor ./script/get_raster_source.bash #16

Closed hugolpz closed 4 years ago

hugolpz commented 7 years ago

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
hugolpz commented 4 years ago

Won't do now.