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

Dylan Beaudette dylan.beaudette at gmail.com
Thu Nov 15 18:50:08 EST 2007


On Thursday 15 November 2007, Dylan Beaudette wrote:
> # 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

And looking at cvs log vector/v.what.rast/main.c

the problem was probably introduced near:

revision 1.28
date: 2007/10/22 15:23:41;  author: carlos;  state: Exp;  lines: +3 -3
Standardization
----------------------------
revision 1.27
date: 2007/10/22 00:25:33;  author: glynn;  state: Exp;  lines: +8 -15
Optimise duplicate elimination


.. I have another copy of GRASS 6.3, with a copy of main.c dated 2007-10-19, 
which does not have this problem.


-- 
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