[GRASS-user] displaying points based on attributes
Moritz Lennert
mlennert at club.worldonline.be
Wed Oct 11 04:12:11 EDT 2006
Hamish wrote:
> Seb wrote:
>> I have imported a shape file containing simple points, with an
>> associated attribute table. I can see the attribute table in the
>> 'dbf' directory of the mapset. When working from the display manager,
>> however, I cannot find how to vary symbols/colors for the points,
>> based on an attribute of choice. Can somebody please point out how
>> this is done? Thanks in advance.
>
> by category:
>
> add the vector map multiple times, one for each symbol/color
> combination, and then restrict with "use SQL query" box.
> e.g. "ATTRIBUTE > 6" or "ATTRIBUTE = 'large'" See the SQL help
> pages for syntax.
>
>
> graduated by value:
>
> d.vect.thematic (Add thematic map layer button next to add vector
> button)
You can also use a grassrgb column in your dbf file, in which you give
an rgb color value (in the form 154:265:247) in each line. You can do
this with v.db.addcol and v.db.update (accessible in GIS Manager via
Databases->Manage Databases). This color then serves as _fillcolor_ (not
outline !), so you have to chose a point icon which can be filled (e.g.
circle, box, etc):
v.db.addcol map=YourMap columns="grassrgb varchar(11)" # create grassrgb
column
v.db.update map=YourMap column=grassrgb value="'255:0:0'"
where="attribute=X" # update grassrgb with color red where attribute is
equal to X (watch out for quoting of color value: single quotes in
double quotes on command line, single quotes in GUI
or
v.db.update map=YourMap column=grassrgb value="'255:0:0'"
where="attribute>X and attribute <= Y" # update grassrgb with color red
where attribute is between X and Y
Then to display your points:
d.vect -a map=YourMap etc...
A while ago, Martin Landa also said that he might try to implement
random colors for any attribute column (instead of only category value):
http://grass.itc.it/pipermail/grass5/2006-June/023516.html
CC'ing him to see if he ever got around to it. This would allow you to
use d.vect -c
The biggest problem I see with all this at this stage in GRASS, is that
with the exception of d.vect.thematic, you cannot easily get a legend
for the colors used...
Moritz
More information about the grass-user
mailing list