[GRASS-user] Problems with v.what.rast

Rebecca Bennett rabennett at ymail.com
Sat Jun 12 11:38:34 EDT 2010


Hi there,

Have had chance to run this script today and it works just fine on my data, thank you so much for your help

Rebecca




________________________________
From: Micha Silver <micha at arava.co.il>
To: Rebecca Bennett <rabennett at ymail.com>
Cc: grass-user at lists.osgeo.org
Sent: Fri, 11 June, 2010 13:13:14
Subject: Re: [GRASS-user] Problems with v.what.rast

 On 06/10/2010 10:43 AM, Rebecca Bennett wrote: 
> 
>Good Morning,
>
>>So yesterday, with lots of help from Micha and Martin, I got a vector
>file with a new column using bash. However when I try to run
>v.what.rast I get the continuous error
>
>>v.what.rast vector=Contour_points_cats at PERMANENT
>raster=dartmoor1 at PERMANENT layer=1 column=rast_value
>>"No record for category 553 in table <Contour_points_cats>
>>No record for category 263 in table <Contour_points_cats>
>>No
>record for category 668 in table <Contour_points_cats>" etc etc
>
>>then the tool crashes without writing any values to the vector. I have
>checked that all points are both within the region and the raster
>extent and that the column type is correct for my float raster. Does
>anyone have any suggestions as to what I might be doing wrong?
>
>
I think I know what the problem might be. You'll need to remove the
database table, then recreate it. This step should make a new entry for
each cat value in a new table. The "v.category opt=del" does wipe out
the single category, but it doesn't touch the old database table, which
might be left with just the single row for cat=1 from your original
Contour_points layer.

So what you'll need is
v.db.droptable Contour_points_cats -f     # -f=force
v.db.addtable Contour_points_cats col="rast_val double precision"
# Check with:
v.db.select Contour_points_cats
# One line for each cat/point?

# Now this should work
v.what.rast Contour_points_cats rast=dartmoor1 col=rast_val

Attached is a script I tested which does the whole procedure. It
prompts you for the original point vector and raster, then creates a
new vector (named "<original>_cats") with individual cats for
each point, deletes then recreates its table and adds a "rast_val"
column, then queries the raster for values.
Warning: the script *overwrites* the vector named <original>_cats.
Warning 2: No checks for region, etc. Use at your own risk... 
There's lots of output, so you should be able to follow what's going on.

Regards,
Micha





Many thanks for reading,
>>Rebecca
>
>
>
>
>
________________________________
From: >Micha Silver <micha at arava.co.il>
>To: Rebecca Bennett
><rabennett at ymail.com>
>Cc: Martin Landa
><landa.martin at gmail.com>; grass-user at lists.osgeo.org
>Sent: Wed, 9 June,
>2010 10:12:28
>Subject: Re:
>[GRASS-user] Re: Problems with v.what.rast
>
> >On 09/06/2010 11:40, Rebecca Bennett wrote:
> 
>Hi Martin,
>>
>>>>I tried the command that Micha suggested v.db.addcol
>>map=Contour_points_cats at PERMANENT layer=1
>>>>columns="rast_value double precision" but this age the following error
>>
>>
>The quotes " " around the "rast_value DOUBLE PRECISION" are necessary.
>Just to check can we see the output of 
>>v.info -c Contour_points_cats
>
>>You might also check that the points are all within the raster region.
>>i.e.:
>>v.info -g Contour_points_cats
>>r.info -g Dartmoor1
>>g.region -p
>> 
>
>v.db.addcol Contour_points_cats col=rast_value DOUBLE PRECISION
>>>>Sorry <DOUBLE> is not a valid option
>>>>Sorry <PRECISION> is not a valid option
>>
>>>>So through the GUI I added a column to the attribute table which gave
>>the command line out put 
>>>>v.db.addcol map=Contour_points_cats at PERMANENT layer=1
>>{columns=rast_value double precision}
>>
>>>>cheers!
>>
>>
>>
>>
________________________________
From: >>Martin Landa <landa.martin at gmail.com>
>>To: Rebecca Bennett
>> <rabennett at ymail.com>
>>Cc: Micha Silver
>> <micha at arava.co.il>;
>> grass-user at lists.osgeo.org
>>Sent: Wed, 9 June,
>>2010 9:37:14
>>Subject: Re:
>>[GRASS-user] Re: Problems with v.what.rast
>>
>>>>Hi,
>>
>>>>2010/6/9 Rebecca Bennett <rabennett at ymail.com>:
>>>>> I added a column v.db.addcol map=Contour_points_cats at PERMANENT
>>layer=1
>>>>> {columns=rast_value double precision} (as my raster is a float),
>>then ran
>>>>> with error
>>
>>>>how did you get this command?
>>
>>>>It should be
>>
>>>>v.db.addcol map=Contour_points_cats at PERMANENT layer=1
>>>>columns="rast_value double precision"
>>
>>>>Martin
>>
>>>>-- 
>>>>Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa
>>
>>
>>
>>>>This mail was received via Mail-SeCure System.
>>
>
>
>-- 
>Micha Silver
>http://www.surfaces.co.il/
>Arava Development Co.  +972-52-3665918
>
>
>
>>This mail was received via Mail-SeCure System.
>
>
>_______________________________________________
>grass-user mailing list
>grass-user at lists.osgeo.org
>http://lists.osgeo.org/mailman/listinfo/grass-user
>
>This mail was received via Mail-SeCure System.
>
>
>


-- 
Micha Silver
Arava Development Co. +972-52-3665918
http://www.surfaces.co.il


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20100612/844c479c/attachment.html


More information about the grass-user mailing list