GRASS and river classification
James Darrell McCauley
mccauley at ecn.purdue.edu
Fri Jun 17 06:37:55 EDT 1994
[please follow-up to grassp-list]
N R A (nra at cix.compulink.co.uk) writes on 15 Jun 94:
>Our organisation carrys out an annual classification of the English &
>Welsh rivers. This ranges from 1A (excellent) to 4 (poor). We can produce
>I'd like to use GRASS to create these maps - the question is how ??
>
>We have the rivers as a vector dataset and I've loaded and plotted these.
>How can I get different parts plotted in a colour corresponding to the
>value of a point or do I have to somehow create a vector set for each
>year of classification - but this would involve storing the coordinates
>many times.
All you need are dig_att files for each year (assuming the rivers
have not been redigitized to reflect changes).
for the best approach, there are two tasks here:
1. labeling lines
2. plotting different colored lines according to labels
I won't comment too much on the first except to say (the obvious) that
each arc that you want colored different needs to be separate. That
is, you need to be able to label various stretches of the river
differently, depending upon your classification scheme. If the break
points or class boundaries cannot be predicted, then you have two options:
1. make each (tiny) line segment an arc (which, as you have pointed out,
would require mega-storage)
2. use a base map and insert nodes at class boundaries each time
a classification is done. (minimum storage)
One way to label these arcs is to use v.digit with the GRASS
monitor--I did this with streams in spearfish for the illustration
below. Depending upon your data, there are surely faster and easier
ways of doing this (using method 2, a short little program could
be developed to insert nodes given a list of eastings/northings).
Regarding the second task, plotting, I'll give the quick and dirty
solution then propose something more sweeping.
| % d.vect.cat help
|
| Usage:
| d.vect.cat map=name [color=name] cat=value[,value,...]
|
| Parameters:
| map Name of existing vector map to be displayed
| color Color desired for drawing map
| options: white,red,orange,yellow,green,blue,indigo,violet,magenta,
| brown,gray,black
| default: white
| cat Vector category type to be displayed
(I think that I must have written this at one time since I have the
binary in ~/bin, but I guess that I threw the source code away... it
should also have an option type=point|line|area but I guess I never
got around to that either.)
Cheerio!
--Darrell
James Darrell McCauley, Purdue Univ, West Lafayette, IN 47907-1146, USA
mccauley at ecn.purdue.edu, mccauley%ecn at purccvm.bitnet, pur-ee!mccauley
-----------------------diffs for d.vect.nra------------------
% pwd
/home/soils/h/mccauley/d.vect
% diff cmd org
diff cmd/Gmakefile org/Gmakefile
1c1
< PGM = d.vect.nra
---
> PGM = d.vect
19c19
< $(PGM): $(OBJS) $(LIBES)
---
> $(BIN_MAIN_CMD)/$(PGM): $(OBJS) $(LIBES)
diff cmd/main.c org/main.c
34a35,41
> opt2 = G_define_option() ;
> opt2->key = "color" ;
> opt2->type = TYPE_STRING ;
> opt2->answer = "white" ;
> opt2->options = D_color_list();
> opt2->description= "Color desired for drawing map" ;
>
48a56,57
> color = D_translate_color(opt2->answer);
>
60a70,71
>
> R_standard_color(color) ;
diff cmd/plot2.c org/plot2.c
19d18
< int linecolor;
21c20
< int line=1, nlines;
---
> int line, nlines;
93,99d91
<
< linecolor=V2_line_att(&P_map, line++);
< if (linecolor<=4 && linecolor>0)
< R_standard_color(linecolor);
< else
< R_standard_color(WHITE);
<
More information about the grass-user
mailing list