[GRASS-dev] nasty bug in v.what.rast (CVS ~ 2 weeks ago)

Dylan Beaudette dylan.beaudette at gmail.com
Thu Nov 15 18:20:07 EST 2007




# setup region
g.region rast=elevation.dem

# create a point
echo "597843.375|4920255.640625" | v.in.ascii out=testing

# add table and make a column for loading elev into
v.db.addtable testing
v.db.addcol testing col='elev double'

# read elevation.dem at the point:
v.what.rast vect=testing rast=elevation.dem col=elev

##
## Ack! what does this mean?
##
WARNING: Raster type is integer and column type is float
WARNING: More points (2) of category 1, value set to 'NULL'
1 categories loaded from table
1 categories loaded from vector
0 categories from vector missing in table
1 duplicate categories in vector
1 records updated
0 update errors

## check result: missing the elevation.dem value
db.select testing
cat|elev
1|


... it looks like this error is being thrown from some kind of caching effort:

# from v.what.rast/main.c:

 for (point = 0 ; point < point_cnt ; point++) {
	if ( cache[point].count > 1 ) {
	    G_warning ( _("More points (%d) of category %d, value set to 'NULL'"), 
		           cache[point].count, cache[point].cat );
	    dupl_cnt++;
	}

	/* category exist in DB ? */
	cex = (int *) bsearch((void *) &(cache[point].cat), catexst, select, 
sizeof(int), srch_cat);
	if ( cex == NULL ) { /* cat does not exist in DB */ 
	    norec_cnt++;
	    G_warning(_("No record for category %d in table <%s>"),
		      cache[point].cat, Fi->table );
	    continue;
	}


I am using CVS from a couple weeks ago.. could this have been recently 
introduced / fixed?

I will download the latest CVS and report back.

Cheers,

Dylan



-- 
Dylan Beaudette
Soil Resource Laboratory
http://casoilresource.lawr.ucdavis.edu/
University of California at Davis
530.754.7341


More information about the grass-dev mailing list