Given a working makefile which crop a world map to a specific country's bounding box.
# boxing:
INDIA_crop.tif: ETOPO1_Ice_g_geotiff.tif
gdal_translate -projwin 67.0 37.5 99.0 05.0 ETOPO1_Ice_g_geotiff.tif INDIA_crop.tif
# ulx uly lrx lry // W N E S
# unzip:
ETOPO1_Ice_g_geotiff.tif: ETOPO1.zip
unzip ETOPO1.zip
touch ETOPO1_Ice_g_geotiff.tif
# download:
ETOPO1.zip:
curl -o ETOPO1.zip 'http://www.ngdc.noaa.gov/mgg/global/relief/ETOPO1/data/ice_surface/grid_registered/georeferenced_tiff/ETOPO1_Ice_g_geotiff.zip'
clean:
rm `ls | grep -v 'zip' | grep -v 'Makefile'`
Given I currently have to change this makefile each time by hand editing the makefile to change:
1. the country name,
2. its North border geocoordinate,
3. its South border geocoordinate,
4. its East border geocoordinate,
5. its West border geocoordinate.
Given I also have a dataset for all countries such :
data = [
{ "W":-62.70; "S":-27.55;"E": -54.31; "N":-19.35; "item":"Paraguay" },
{ "W": 50.71; "S": 24.55;"E": 51.58; "N": 26.11; "item":"Qatar" },
{ "W": 20.22; "S": 43.69;"E": 29.61; "N": 48.22; "item":"Romania" },
{ "W": 19.64; "S": 41.15;"E":-169.92; "N": 81.25; "item":"Russia" },
{ "W": 29.00; "S": -2.93;"E": 30.80; "N": -1.14; "item":"Rwanda" },
{ "W": 34.62; "S": 16.33;"E": 55.64; "N": 32.15; "item":"Saudi Arabia"}
];
How to loop on each line of the data so to set parameters into my makefile ? So I output at once all the files COUNTRYNAME_crop.tif
with the correct bounding boxes.