I have been trying to rasterise a point dataset, many points are exactly on
top of each other.
They have the attribute Count
|Count|
+-----+
| 15 |
| 51 |
| 31 |
| 12 |
I think when I run r.to.rast it is only taking one of the count values and
not summing the totals as when I query the data base sum('Count') I get
different values (more in the database than the raster (r.stat))
If you want to get a raster with the sum of the point values you will
probably have to first create a vector file where the value in each
point is the sum. Then you rasterize this vector. Just not sure how
it´s done....
Another way that might work, is export the points as ascii and use
r.in.xyz. The command was not designed for that but should work...
Good luck
Daniel
On Sat, Mar 20, 2010 at 8:28 AM, Gary Nobles <garynobles@yahoo.com> wrote:
Hi,
I have been trying to rasterise a point dataset, many points are exactly on
top of each other.
They have the attribute Count
|Count|
+-----+
| 15 |
| 51 |
| 31 |
| 12 |
I think when I run r.to.rast it is only taking one of the count values and
not summing the totals as when I query the data base sum('Count') I get
different values (more in the database than the raster (r.stat))
Another way that might work, is export the points as ascii
and use r.in.xyz. The command was not designed for that but
should work...
actually r.in.xyz is inspired by s.cellstats for GRASS 5, and this
is exactly the sort of thing s.cellstats was designed to do. so
it is a good insight.
you can pipe directly from v.out.ascii to r.in.xyz btw.
However i need to specify a column for x and y (z=Count column)
How do I create a new column in my database of x and y values? Is there an
automatic way, I vaguely remember something about it v.report?
You do that with:
v.db.addcol BonesVect col="XCOORD double precision, YCOORD double precision"
then
v.to.db BonesVect opt=coor col=XCOORD,YCOORD
However you don't need this for v.out.ascii. It creates a text file of the coordinates (+ any additional columns you specify )
Also I have never tried pipeing is it something like this:
Not quite. The idea of piping is avoiding the intermediate file, so
v.out.ascii BonesVect | r.in.xyz input=- out=BonesRast method=sum
should do it. (The dash after input= means "read input from STDIN, thru the pipe)
The z= parameter is for altitude values. I'm not sure this is relevant in this case. By using the method=sum you should get a value in each raster cell that represents a count of the number of points from the BonesVect that fall in that cell.
Oh thank you so much! Now at last I can get on and do some actual work rather
than data processing!
FYI I'm an archaeologist working on an Archaeological site which was
excavated in the 1980s in North Holland and trying to push the boundaries of
intra site analysis (if I ever get that far!) The site has over 30,000
animal bones, hence why I was slightly concerned when r.stats returned only
15,000!
If interested website www.singlegrave.nl
Next stop R!
I used GRASS for my Masters 3 years ago so that's why I'm so rusty. This is
all for my Phd so you all will get an acknowledgment!
here I used the numeric "cat" column as the data value. run
v.out.ascii without the pipe to check which column you need
to pick. nb spearfish's archsites map is not very interesting
as it only has 25 points in it to begin with.
Micha:
The z= parameter is for altitude values. I'm not sure this is > relevant in this case.
it doesn't have to be elevation. the z= data can represent anything numeric. from the help page:
x Column number of x coordinates in input file (first column is 1)
default: 1
y Column number of y coordinates in input file
default: 2
z Column number of data values in input file
default: 3