<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  <title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
On 06/10/2010 10:43 AM, Rebecca Bennett wrote:
<blockquote cite="mid:233225.42911.qm@web28409.mail.ukl.yahoo.com"
 type="cite">
  <style type="text/css"><!-- DIV {margin:0px;} --></style>
  <div
 style="font-family: verdana,helvetica,sans-serif; font-size: 10pt;">
  <div>Good Morning,<br>
  <br>
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<br>
  <br>
v.what.rast vector=Contour_points_cats@PERMANENT
raster=dartmoor1@PERMANENT layer=1 column=rast_value<br>
"No record for category 553 in table &lt;Contour_points_cats&gt;<br>
No record for category 263 in table &lt;Contour_points_cats&gt;<br>
No
record for category 668 in table &lt;Contour_points_cats&gt;" etc etc<br>
  <br>
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?<br>
  <br>
  </div>
  </div>
</blockquote>
<br>
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.<br>
<br>
So what you'll need is<br>
v.db.droptable Contour_points_cats -f     # -f=force<br>
v.db.addtable Contour_points_cats col="rast_val double precision"<br>
# Check with:<br>
v.db.select Contour_points_cats<br>
# One line for each cat/point?<br>
<br>
# Now this should work<br>
v.what.rast Contour_points_cats rast=dartmoor1 col=rast_val<br>
<br>
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 "&lt;original&gt;_cats") with individual cats for
each point, deletes then recreates its table and adds a "rast_val"
column, then queries the raster for values.<br>
Warning: the script *overwrites* the vector named &lt;original&gt;_cats.<br>
Warning 2: No checks for region, etc. Use at your own risk... <br>
There's lots of output, so you should be able to follow what's going on.<br>
<br>
Regards,<br>
Micha<br>
<br>
<br>
<br>
<br>
<blockquote cite="mid:233225.42911.qm@web28409.mail.ukl.yahoo.com"
 type="cite">
  <div
 style="font-family: verdana,helvetica,sans-serif; font-size: 10pt;">
  <div>Many thanks for reading,<br>
Rebecca<br>
  <br>
  </div>
  <div
 style="font-family: verdana,helvetica,sans-serif; font-size: 10pt;"><br>
  <div
 style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><font
 face="Tahoma" size="2">
  <hr size="1"><b><span style="font-weight: bold;">From:</span></b>
Micha Silver <a class="moz-txt-link-rfc2396E" href="mailto:micha@arava.co.il">&lt;micha@arava.co.il&gt;</a><br>
  <b><span style="font-weight: bold;">To:</span></b> Rebecca Bennett
<a class="moz-txt-link-rfc2396E" href="mailto:rabennett@ymail.com">&lt;rabennett@ymail.com&gt;</a><br>
  <b><span style="font-weight: bold;">Cc:</span></b> Martin Landa
<a class="moz-txt-link-rfc2396E" href="mailto:landa.martin@gmail.com">&lt;landa.martin@gmail.com&gt;</a>; <a class="moz-txt-link-abbreviated" href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a><br>
  <b><span style="font-weight: bold;">Sent:</span></b> Wed, 9 June,
2010 10:12:28<br>
  <b><span style="font-weight: bold;">Subject:</span></b> Re:
[GRASS-user] Re: Problems with v.what.rast<br>
  </font><br>
  <title></title>
On 09/06/2010 11:40, Rebecca Bennett wrote:
  <blockquote type="cite">
    <div
 style="font-family: verdana,helvetica,sans-serif; font-size: 10pt;">
    <div>Hi Martin,<br>
    <br>
I tried the command that Micha suggested v.db.addcol
map=Contour_points_cats@PERMANENT layer=1<br>
columns="rast_value double precision" but this age the following error<br>
    <br>
    </div>
    </div>
  </blockquote>
The quotes " " around the "rast_value DOUBLE PRECISION" are necessary.
Just to check can we see the output of <br>
v.info -c Contour_points_cats<br>
  <br>
You might also check that the points are all within the raster region.<br>
i.e.:<br>
v.info -g Contour_points_cats<br>
r.info -g Dartmoor1<br>
g.region -p<br>
 <br>
  <blockquote type="cite">
    <div
 style="font-family: verdana,helvetica,sans-serif; font-size: 10pt;">
    <div>v.db.addcol Contour_points_cats col=rast_value DOUBLE PRECISION<br>
Sorry &lt;DOUBLE&gt; is not a valid option<br>
Sorry &lt;PRECISION&gt; is not a valid option<br>
    <br>
So through the GUI I added a column to the attribute table which gave
the command line out put <br>
v.db.addcol map=Contour_points_cats@PERMANENT layer=1
{columns=rast_value double precision}<br>
    <br>
cheers!<br>
    </div>
    <div
 style="font-family: verdana,helvetica,sans-serif; font-size: 10pt;"><br>
    <div
 style="font-family: arial,helvetica,sans-serif; font-size: 13px;"><font
 face="Tahoma" size="2">
    <hr size="1"><b><span style="font-weight: bold;">From:</span></b>
Martin Landa <a moz-do-not-send="true" rel="nofollow"
 class="moz-txt-link-rfc2396E" ymailto="mailto:landa.martin@gmail.com"
 target="_blank" href="mailto:landa.martin@gmail.com">&lt;landa.martin@gmail.com&gt;</a><br>
    <b><span style="font-weight: bold;">To:</span></b> Rebecca Bennett
    <a moz-do-not-send="true" rel="nofollow"
 class="moz-txt-link-rfc2396E" ymailto="mailto:rabennett@ymail.com"
 target="_blank" href="mailto:rabennett@ymail.com">&lt;rabennett@ymail.com&gt;</a><br>
    <b><span style="font-weight: bold;">Cc:</span></b> Micha Silver
    <a moz-do-not-send="true" rel="nofollow"
 class="moz-txt-link-rfc2396E" ymailto="mailto:micha@arava.co.il"
 target="_blank" href="mailto:micha@arava.co.il">&lt;micha@arava.co.il&gt;</a>;
    <a moz-do-not-send="true" rel="nofollow"
 class="moz-txt-link-abbreviated"
 ymailto="mailto:grass-user@lists.osgeo.org" target="_blank"
 href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a><br>
    <b><span style="font-weight: bold;">Sent:</span></b> Wed, 9 June,
2010 9:37:14<br>
    <b><span style="font-weight: bold;">Subject:</span></b> Re:
[GRASS-user] Re: Problems with v.what.rast<br>
    </font><br>
Hi,<br>
    <br>
2010/6/9 Rebecca Bennett &lt;<a moz-do-not-send="true" rel="nofollow"
 ymailto="mailto:rabennett@ymail.com" target="_blank"
 href="mailto:rabennett@ymail.com">rabennett@ymail.com</a>&gt;:<br>
&gt; I added a column v.db.addcol map=Contour_points_cats@PERMANENT
layer=1<br>
&gt; {columns=rast_value double precision} (as my raster is a float),
then ran<br>
&gt; with error<br>
    <br>
how did you get this command?<br>
    <br>
It should be<br>
    <br>
v.db.addcol map=Contour_points_cats@PERMANENT layer=1<br>
columns="rast_value double precision"<br>
    <br>
Martin<br>
    <br>
-- <br>
Martin Landa &lt;landa.martin gmail.com&gt; * <a moz-do-not-send="true"
 rel="nofollow" target="_blank" href="http://gama.fsv.cvut.cz/%7Elanda">http://gama.fsv.cvut.cz/~landa</a><br>
    </div>
    </div>
    </div>
    <br>
    <br>
    <br>
This mail was received via Mail-SeCure System.<br>
  </blockquote>
  <br>
  <br>
  <pre class="moz-signature">-- 
Micha Silver
<a moz-do-not-send="true" rel="nofollow" class="moz-txt-link-freetext"
 target="_blank" href="http://www.surfaces.co.il/">http://www.surfaces.co.il/</a>
Arava Development Co.  +972-52-3665918
  </pre>
  </div>
  </div>
  </div>
  <br>
  <br>
  <br>
This mail was received via Mail-SeCure System.<br>
  <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
grass-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/grass-user">http://lists.osgeo.org/mailman/listinfo/grass-user</a>

This mail was received via Mail-SeCure System.


  </pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">-- 
Micha Silver
Arava Development Co. +972-52-3665918
<a class="moz-txt-link-freetext" href="http://www.surfaces.co.il">http://www.surfaces.co.il</a>
 
</pre>
</body>
</html>