I have a fodler with 1500 ECW rasters, no spatial reference information defined. Can I use GDAL to batch define a projection for all 1500 in the folder?
Answer
ECW is ERDAS Compressed Wavelets (.ecw) type and support for it's not enabled by default (it needs the ECW SDK). There might be an option to install the necessary requirements via the OSGeo4W installer.
Check one of your files with gdalinfo
, and if you get a valid output then, you can use the gdalwarp utility with -t_srs EPSG:XXXX
and -te xmin ymin xmax ymax
flags.
If you have installed gdal with the OSGeo4W installer, you should have the MSYS program which is a collection of GNU utilities such as bash and others.
Open it, cd to your folder and issue the following command:
for file in $(ls .ecw); do
gdalwarp -t_srs EPSG:XXXX -te xmin ymin xmax ymax $file $(basename $file .ecw).tif;
done
The above command will create georeferenced geotiffs based on the inputs. BEfore batch processing all the files, try it on a test file first. The -te numbers are the extends of your raster in georeferenced coordinates, and EPSG is the CRS of your choice.
No comments:
Post a Comment