Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a lot of DEMs that I want to use to create hillshades, slopes and color relief from and would like to automate the processes using a shell script within OSgeo4W shell. Here is the code I used within the shell script to automate the creation of hillshades.

for f in *.tif
do
  echo "Processing $f"
gdaldem hillshade $f $f-hillshade" -z 1.0 -s 1.0 -az 315.0 -alt 45.0 -compute_edges -of GTiff
done

I'm new to OSgeo4W and shell scripting. I'm working off this example as a starting point. When I call the shell script within the OSgeo4W I get an error message that Windows can't open the file and then it gives me an option to use the web to find the correct program or to manually select a program to use.

I had assumed that OSgeo4W installed everything I would need to run shell scripts in Windows. What am I missing?

share|improve this question

1 Answer 1

It turns out that I forgot to type sh before the shell script in the osgeo4w. I also had an extra pair of quotes after hillshade in script. Once I removed the quotes and typed "sh hillshade.sh" into the osgeo4w shell everything worked like a charm. See below for the updated and correct script. Man this is going to save me a ton of time!

for f in *.tif
do
  echo "Processing $f"
gdaldem hillshade $f $f-hillshade -z 1.0 -s 1.0 -az 315.0 -alt 45.0 -compute_edges -of GTiff
done
share|improve this answer
    
If this answers your question, please mark it as accepted (click grey checkmark below question vote count up/down). –  Chad Cooper Dec 31 '12 at 0:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.