[GRASS-dev] v.info

Glynn Clements glynn at gclements.plus.com
Fri Mar 16 16:15:13 EDT 2007


Helena Mitasova wrote:

> I might have missed something, but I am running v.info in about 3 days 
> old CVS GRASS
> and it asks for output map? However, the example in the man page is
> v.info map=test
> 
> Why do we need output map for v.info?
> 
> Thanks, Helena
> 
> GRASS 6.3.cvs > v.info -g soils_general
> 
> ERROR: Required parameter <output> not set:
> (Name for output vector map).
> 
> Usage:
> v.info [-hcgt] input=name output=name [--overwrite] [--verbose]
> [--quiet]

If you update the source code from CVS, you have to run "make clean"
before re-compiling; otherwise, you get problems like this.

The specific problem is:

  fieldopt = G_define_standard_option(G_OPT_V_FIELD);

The enum constants in gis.h changed between 1.39 (which is what your
v.info uses) and 1.42 (which is what your libgis uses):

	value revision 1.42   revision 1.39
	 0    G_OPT_WHERE     G_OPT_WHERE         
	 1    G_OPT_COLUMN    G_OPT_I_GROUP       
	 2    G_OPT_COLUMNS   G_OPT_R_INPUT       
	 3    G_OPT_I_GROUP   G_OPT_R_INPUTS      
	 4    G_OPT_R_INPUT   G_OPT_R_OUTPUT      
	 5    G_OPT_R_INPUTS  G_OPT_R_MAP         
	 6    G_OPT_R_OUTPUT  G_OPT_R_MAPS        
	 7    G_OPT_R_MAP     G_OPT_R_BASE        
	 8    G_OPT_R_MAPS    G_OPT_R_COVER       
	 9    G_OPT_R_BASE    G_OPT_R_ELEV        
	10    G_OPT_R_COVER   G_OPT_R_ELEVS       
	11    G_OPT_R_ELEV    G_OPT_R3_INPUT      
	12    G_OPT_R_ELEVS   G_OPT_R3_INPUTS     
	13    G_OPT_R3_INPUT  G_OPT_R3_OUTPUT     
	14    G_OPT_R3_INPUTS G_OPT_V_INPUT       
	15    G_OPT_R3_OUTPUT G_OPT_V_OUTPUT      
	16    G_OPT_V_INPUT   G_OPT_V_MAP         
	17    G_OPT_V_INPUTS  G_OPT_V_TYPE        
=>	18    G_OPT_V_OUTPUT  G_OPT_V_FIELD       
	19    G_OPT_V_MAP     G_OPT_V_CAT         
	20    G_OPT_V_TYPE    G_OPT_V_CATS        
	21    G_OPT_V_FIELD
	22    G_OPT_V_CAT
	23    G_OPT_V_CATS

v.info was compiled when G_OPT_V_FIELD == 18, so that's what gets
passed to libgis, which sees it as G_OPT_V_OUTPUT.

Although we could adopt a policy of not "renumbering" the G_OPT_*
constants, I would rather that people who forget "make clean" get
obvious errors that can be quickly identified than by obscure errors
that cause us to waste hours or even days trying to identify.

I'd even suggest changing G_gisinit() to e.g.:

gisdefs.h:

	#define G_gisinit(pgm) G__gisinit(GRASS_CVS_VERSION, (pgm))

lib/gis/gisinit.c:

	int G__gisinit(const char *version, const char *pgm)
	{
	    if (strcmp(version, GRASS_CVS_VERSION) != 0)
		G_fatal_error("GRASS version mismatch);

	...

The only problem here is that we would have to update the value of
GRASS_CVS_VERSION regularly (e.g. daily) for this to be of much use.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list