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 raster map in GRASS containing elevation values. I want to display the elevation values in only one color (specificaly blue) but in varying shades of blue. I tried the options in r.colors, but none of those displays the map in monochrome.

share|improve this question
add comment

1 Answer

up vote 9 down vote accepted

In GRASS shell type:

> r.colors map=elevation color=rules 
> 0 white
> [your maximum elevation value] blue
> end
share|improve this answer
4  
Or simply 0% white 100% blue. –  Jake Mar 17 '11 at 15:35
    
I tried creating a shell script containing: #!/bin/sh r.colors map=raster_bulacanOriginal2 color=rules 0 white 300 blue end and GRASS just kept on freezing –  teamAngat Mar 17 '11 at 16:22
4  
It's not freezing, it's expecting input. If you want to use it in a shell script, you need to do something like #!/bin/sh echo -e '0 white\n300 blue' | r.colors map=<mapname> color=rules rules=-, which pipes the color rule to the r.colors command. The rules=- option tells r.colors to expect the rule from the pipe. Or you can save the color rule to a file, and use r.colors map=<mapname> color=rules rules=<rulesfile>. –  Jake Mar 17 '11 at 17:16
    
Thanks! I noticed that the color for the rules only uses color names. Can ASCII colors be used? I tried assigning a HEX color to a certain value and it produced this error: ERROR: bad rule (invalid color name): [-25 #00FFFF] –  teamAngat Mar 18 '11 at 8:54
1  
According to grass.osgeo.org/grass62/manuals/html62_user/r.colors.html, you'd have to write '0 255 255' instead of '#00FFFF'. –  underdark Mar 18 '11 at 8:58
show 1 more comment

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.