I need to do batch processing from a raster with 120 bands (GeoTIFF). I need 120 contour line shapefiles, but I get only one. I had no problem when the result is another raster file with all the bands, but the contour line is a shapefile, I don´t know if this is the problem...
1 Answer
with the commanline tool gdal_contour you can choose from which band the contour lines shall be created. In this example band 42
:
gdal_contour -a elev dem.tif contour_band_42.shp -i 10.0 -b 42
This can be integrated in a batch file. On Unix it should be something like this:
for BAND in {1..120}
do
gdal_contour -a elev dem.tif contour_band_${BAND}.shp -i 10.0 -b ${BAND}
done
-
Thanks Jakob, It sounds correct, but is not posible to edit GDAL console. I try to run in python console the script but it dosen´t work, neither the one that GDAL create for one band– CaroCommented Oct 18, 2019 at 17:55
-
which operating system are you using? On Windows you have the GDAL commandline tools inside the OSGeo4W shell. There the syntax for the for loop might be slightly different than in my answer. Commented Oct 19, 2019 at 14:14
-