[GRASS5] v.extract problems

Glynn Clements glynn.clements at virgin.net
Sat Apr 20 11:04:11 EDT 2002


[Roger: mail to rgrmill at rt66.com is bouncing.]

Roger Miller wrote:

> > Which options were used to specify the categories? I.e. were either of
> > "-n" and/or "file=" used?
> 
> As far as I got in gdb, the fault at line 272 was caused because "&cats" in 
> the arguments for G_get_cats was zero.

That can't happen; "cats" is a local variable, so "&cats" will always
be an address within the stack. I can only assume that gdb is "lying";
try compiling without optimisation (e.g. "CFLAGS= ./configure ...", or
edit the head.<platform> file).

> I didn't use -n.  I got the same result using both file= and list=.

OK, that narrows down the possibilities.

> In my most recent test using the current code from CVS the full command line 
> was:
> 
> v.extract i=HidalgoCoTx o=test new=0 type=line list=39-50
> 
> Category 39 is the lowest category.  Category 42 is missing.  If I use 
> line=39-41 v.extract runs without errors.  If I use line=39-43 v.extract gets 
> a seg fault.

AFAICT, the most likely reason is that G_get_cat() is returning NULL,
and G_set_cat() is calling G_store(NULL), which segfaults.

I'll add a check for NULL labels.

> When it does run, I get a correct-looking dig_cats file, an empty dig_att 
> file and a dig_ascii file with nothing but a header.  The lack of results may 
> be a completely different problem.

The "dig_att" file and the actual "dig" file are written by
xtract_{line,area}, which haven't been changed. AFAICT, v.extract
won't write a "dig_ascii" file.

-- 
Glynn Clements <glynn.clements at virgin.net>



More information about the grass-dev mailing list