[GRASS-user] v.to.rast multiple points per pixel

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

Is this right? How to I get around this?

Thanks again

Gary
--
View this message in context: http://n2.nabble.com/v-to-rast-multiple-points-per-pixel-tp4768008p4768008.html
Sent from the Grass - Users mailing list archive at Nabble.com.

Gary,

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

Is this right? How to I get around this?

Thanks again

Gary
--
View this message in context: http://n2.nabble.com/v-to-rast-multiple-points-per-pixel-tp4768008p4768008.html
Sent from the Grass - Users mailing list archive at Nabble.com.
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Daniel Victoria wrote:

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.

Hamish

ok, so

v.out.ascii input=BonesVect output=bones_temp.asc

r.in.xyz input=bones_temp.asc output=BonesRast method=sum x=1 y=2 z=3

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?

Also I have never tried pipeing is it something like this:

v.out.ascii input=BonesVect output=bones_temp.asc | r.in.xyz
input=bones_temp.asc output=BonesRast method=sum x=1 y=2 z=3

Thanks again

Gary
--
View this message in context: http://n2.nabble.com/v-to-rast-multiple-points-per-Cell-tp4768008p4769688.html
Sent from the Grass - Users mailing list archive at Nabble.com.

Gary Nobles wrote:

ok, so

v.out.ascii input=BonesVect output=bones_temp.asc

r.in.xyz input=bones_temp.asc output=BonesRast method=sum x=1 y=2 z=3

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)

v.out.ascii input=BonesVect output=bones_temp.asc | r.in.xyz
input=bones_temp.asc output=BonesRast method=sum x=1 y=2 z=3
  

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.

Regards,
Micha

Thanks again

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

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!

Again many thanks

Gary

--
View this message in context: http://n2.nabble.com/v-to-rast-multiple-points-per-Cell-tp4768008p4770649.html
Sent from the Grass - Users mailing list archive at Nabble.com.

Gary wrote:

ok, so

v.out.ascii input=BonesVect output=bones_temp.asc

r.in.xyz input=bones_temp.asc output=BonesRast method=sum \
   x=1 y=2 z=3

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?

  v.out.ascii columns=

for example (spearfish dataset)
  v.out.ascii archsites column=str1

that also prints the attribute column data stored in the "str1"
column.

Also I have never tried pipeing is it something like this:

v.out.ascii input=BonesVect output=bones_temp.asc |
  r.in.xyz input=bones_temp.asc output=BonesRast method=sum
     x=1 y=2 z=3

yes, but with the extra data column and you need to bypass
the intermediate output/input filenames. so for the spearfish
example it would look like:

g.region n= s= w= e= res= # set up the wanted grid size first!

v.out.ascii archsites column=cat | r.in.xyz input=- \
  method=sum x=1 y=2 z=4 output=archsites.sum

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

regards,
Hamish