GIS4DEV / GIS4DEV.github.io

Open Source GIScience & GIS for Development
1 stars 12 forks source link

Output for Batch Script problems #3

Closed tori-koontz closed 4 years ago

tori-koontz commented 4 years ago

When running batch script to access SAGA tools, like hillshade, files are created that contain nothing or cannot be recognized/opened in SAGA. Is this a problem with the output field in the batch script? Is there another issue in my script? Am i just incompetent?

Here's my current script, which is only trying to use hillshade. It doesn't contain previous script for mosaic/UTM transformation, and it instead accesses the files that the previous batch process created (already mosaicked).

:: Batch script for ASTER elevation data: hillshade, sink detection, sink removal, flow accumulation, channel network :: Completed (or rather, attempted) by Tori Koontz, world's worst GIS student

::set the path to your SAGA program SET PATH=%PATH%;c:\saga6

::set the prefix to use for all names and outputs SET pre=ASanalysis_

::set the directory in which you want to save ouputs. In the example below, part of the directory name is the prefix you entered above SET od=W:\GEOG323_OpenSource\lab4\attempt2\ASTER_elevation

:: the following creates the output directory if it doesn't exist already if not exist %od% mkdir %od%

:: Hillshading saga_cmd ta_lighting 0 -ELEVATION=W:\GEOG323_OpenSource\lab4\Attempt2\ASTER_elevation\Mosaic\mosaicUTM.sgrd -SHADE=NULL -METHOD=0 -POSITION=0 -AZIMUTH=315.000000 -DECLINATION=45.000000 -DATE=2019-10-07 -TIME=12.000000 -EXAGGERATION=1.000000 -UNIT=0 -SHADOW=0 -NDIRS=8 -RADIUS=10.000000

::print a completion message so that uneasy users feel confident that the batch script has finished! ECHO Processing Complete! PAUSE;

josephholler commented 4 years ago

Yes, we need to set the output parameter for Analytical Hillshading. According to the documentation, the output is the -SHADE parameter, and that is currently set to NULL. So, how can you tell it to create a new file in your working directory? -SHADE=%od%\%pre%_Hillshade.sgrd should do the trick. by starting with %od% the file will be placed in whatever directory you designated for od, and by inserting %pre%, the file name will begin with whatever prefix you set for pre

Also, you can remove any of the parameters for which you're comfortable using the default values, since if you don't specify something, it'll use the default anyway! Keeping the parameters with default values in doesn't change things either way.