/* Name: image2grid.aml /* Function: Converts all the image files (TIF & BIL) inside folder into grids /* Author: Maxim Dubinin /* sim@gis-lab.info /* Created 04/20/2006 /* Last Update: 12/14/2006 /* Notes: For folders names use ending slash, for example: c:\temp\ /****************** THIS AML MUST BE RUN IN ARC/INFO WORKSTATION ***************************** &args sourcedir outputdir /* Usage error handling &if [null %sourcedir%] &then &do &type &type Usage: &r image2grid {output folder} &type &ret &end &workspace %sourcedir% &type Workspace set to %sourcedir% /* get a list of all file names to use &do &s inf = covs.lst &if [filelist * covs.lst -image] < 0 &then &ret Error creating coverage list &end /* Open list file if able &s infile := [open %inf% status -read] &if %status% <> 0 &then &return &warning Error opening file. &setvar current := [read %infile% readstatus] &if %readstatus% <> 0 &then &return &warning Could not read file. /* Select each import file from list, if coverage exists, project it &do &while %readstatus% = 0 &if [exists %current% -image] &then &do &s output := [subst %current% .tif] &s output := [subst %output% .bil] &if %outputdir% <> null &then &do &s output := [UNQUOTE %outputdir%]%output% &end &type Converting TIF/BIL %current% to GRID %output% &type imagegrid %current% %output% imagegrid %current% %output% /* Read next line. &setvar current := [read %infile% readstatus] &end &end /* Close file. &if [close %infile%] <> 0 &then &type Unable to close %infile%. &if [delete %inf%] <> 0 &then &type Unable to delete %inf%. &return Finished