Opened 13 years ago

Closed 8 years ago

#1474 closed defect (fixed)

random color -c flag broken in d.vect

Reported by: cmbarton Owned by: grass-dev@…
Priority: normal Milestone: 7.0.5
Component: Vector Version: svn-trunk
Keywords: d.vect Cc:
CPU: Unspecified Platform: Unspecified

Description

d.vect -c no longer colors vector areas in random colors. I just tried it on the geology map from the spm07 demo set (after rebuilding the map for GRASS 7). All areas remain displayed as grey. I tried it from the wxGUI and from the command line using d.mon. There were no errors It just didn't work.

Change History (8)

comment:1 by cmbarton, 13 years ago

A followup. This works fine on GRASS 6.4.2 svn

comment:2 by cmbarton, 12 years ago

This is caused by setting the layer default to -1 instead of 1. Setting this default to -1 causes other problems with querying and labeling. IMHO, the default should be 1, which is the case for most vectors and would avoid bogus errors like this one.

Michael

in reply to:  2 comment:3 by neteler, 12 years ago

Version: unspecifiedsvn-trunk

Replying to cmbarton:

This is caused by setting the layer default to -1 instead of 1. Setting this default to -1 causes other problems with querying and labeling. IMHO, the default should be 1, which is the case for most vectors and would avoid bogus errors like this one.

I wonder where the new -1 default in GRASS 7 is documented. Not in

http://grass.osgeo.org/wiki/GRASS_7_ideas_collection http://trac.osgeo.org/grass/wiki/Grass7/VectorLib http://trac.osgeo.org/grass/wiki/Grass7/NewFeatures#Libvector ?

comment:4 by cmbarton, 12 years ago

This seems to be a global default chosen throughout all vector modules that have the option of choosing layers. Where is it set for all of GRASS 7 vectors?

Michael

in reply to:  4 comment:5 by martinl, 12 years ago

Replying to cmbarton:

This seems to be a global default chosen throughout all vector modules that have the option of choosing layers. Where is it set for all of GRASS 7 vectors?

it's G_OPT_V_FIELD_ALL defined in gislib source:grass/trunk/lib/gis/parser_standard_options.c#L468

Regarding d.vect we could use for layer option G_OPT_V_FIELD which defines default answer as 1. Then layers different from '1' will be not rendered by default. Or we could just fix d.vect to colorize vector features based on layer '1' when layer=-1 is entered.

comment:6 by cmbarton, 12 years ago

It also affects querying and labels for d.vect. Additionally, it looks like -1 is the default layer selected for all other v.* modules. This may or may not cause problems. I understand your point.

But the most common case for vectors is to have one layer. Someone who wants to display more than one layer can switch to -1 for display as easily as someone who wants to use layer 1 instead of -1. But it seems we should default to the most common case rather than less common ones.

Michael

comment:7 by martinl, 8 years ago

Milestone: 7.0.07.0.5

comment:8 by wenzeslaus, 8 years ago

Resolution: fixed
Status: newclosed

d.vect -c map=geology works as expected.

d.vect --help now says:

layer   Layer number or name ('-1' for all layers)
         A single vector map can be connected to multiple database tables. This number determines which table to use. When used with direct OGR access this is the layer name.
        default: 1

Most of the modules now (7.0) use G_OPT_V_FIELD which has layer name/number 1. Several modules use G_OPT_V_FIELD_ALL which uses -1 as default.

Closing as fixed.

Note: See TracTickets for help on using tickets.