v.stats.rast for category raster or vector cross statistics

3 messages Options
Embed this post
Permalink
Agustin Lobo-2

v.stats.rast for category raster or vector cross statistics

Reply Threaded More More options
Print post
Permalink
Dear lists,

Given Av (vector of polygons) and Br (raster of a categorical variable,
i.e. a classification or a soil map) I want to calculate
for each polygon in Av, the surface of each category from Br.

v.stats.rast almost does it, but calculates lumped stats for each
polygon (i.e, assumes that Br is a continuous variable).

Alternatively, I could have Br as another vector Bv, but don't find
the way of calculating cross stats as r.stats -a in=Ar,Br would do for
raster layers.

Converting Av into raster Ar is inconvenient, as the polygons are few
and small and would have to use a very samll cell size (Br is large)

Any easier way through R?

--
Dr. Agustin Lobo
Institut de Ciencies de la Terra "Jaume Almera" (CSIC)
LLuis Sole Sabaris s/n
08028 Barcelona
Spain
Tel. 34 934095410
Fax. 34 934110012
email: [hidden email]
http://www.ija.csic.es/gt/obster

_______________________________________________
statsgrass mailing list
[hidden email]
http://grass.itc.it/mailman/listinfo/statsgrass
Matthew Perry

Re: v.stats.rast for category raster or vector cross statistics

Reply Threaded More More options
Print post
Permalink
Agustin,


I would suggest taking a look at starspan
(http://starspan.casil.ucdavis.edu/). It specializes in
vector-on-raster analyses and has a --count-by-class flag for
categorical rasters. I wrote a bit more about it at
http://www.perrygeo.net/wordpress/?p=30 .

- matt
 On 10/22/07, Agustin Lobo <[hidden email]> wrote:
> Dear lists,
>
> Given Av (vector of polygons) and Br (raster of a categorical variable,
> i.e. a classification or a soil map) I want to calculate
> for each polygon in Av, the surface of each category from Br.
>
> v.stats.rast almost does it, but calculates lumped stats for each
> polygon (i.e, assumes that Br is a continuous variable).
>

> Alternatively, I could have Br as another vector Bv, but don't find
> the way of calculating cross stats as r.stats -a in=Ar,Br would do for
> raster layers.
>
> Converting Av into raster Ar is inconvenient, as the polygons are few
> and small and would have to use a very samll cell size (Br is large)
>
> Any easier way through R?
>
> --
> Dr. Agustin Lobo
> Institut de Ciencies de la Terra "Jaume Almera" (CSIC)
> LLuis Sole Sabaris s/n
> 08028 Barcelona
> Spain
> Tel. 34 934095410
> Fax. 34 934110012
> email: [hidden email]
> http://www.ija.csic.es/gt/obster
>
> _______________________________________________
> statsgrass mailing list
> [hidden email]
> http://grass.itc.it/mailman/listinfo/statsgrass
>


--
Matthew T. Perry
http://www.perrygeo.net

"Never ascribe to malice, that which can be adequately explained by
incompetence."

_______________________________________________
statsgrass mailing list
[hidden email]
http://grass.itc.it/mailman/listinfo/statsgrass
Roger Bivand

Re: [R-sig-Geo] v.stats.rast for category raster or vector cross statistics

Reply Threaded More More options
Print post
Permalink
On Mon, 22 Oct 2007, Matthew Perry wrote:

> Agustin,
>
>
> I would suggest taking a look at starspan
> (http://starspan.casil.ucdavis.edu/). It specializes in
> vector-on-raster analyses and has a --count-by-class flag for
> categorical rasters. I wrote a bit more about it at
> http://www.perrygeo.net/wordpress/?p=30 .
>
> - matt
> On 10/22/07, Agustin Lobo <[hidden email]> wrote:
>> Dear lists,
>>
>> Given Av (vector of polygons) and Br (raster of a categorical variable,
>> i.e. a classification or a soil map) I want to calculate
>> for each polygon in Av, the surface of each category from Br.
>>
>> v.stats.rast almost does it, but calculates lumped stats for each
>> polygon (i.e, assumes that Br is a continuous variable).
>>
>
>> Alternatively, I could have Br as another vector Bv, but don't find
>> the way of calculating cross stats as r.stats -a in=Ar,Br would do for
>> raster layers.
>>
>> Converting Av into raster Ar is inconvenient, as the polygons are few
>> and small and would have to use a very samll cell size (Br is large)
>>
>> Any easier way through R?

StarSpan is a good suggestion for heavy lifting. Within R, you could look
at the overlay methods in sp to create a vector for polygon membership of
raster size, then write a tapply function to accumulate tables with zero
counts on categories by the polygon index.

Roger

>>
>> --
>> Dr. Agustin Lobo
>> Institut de Ciencies de la Terra "Jaume Almera" (CSIC)
>> LLuis Sole Sabaris s/n
>> 08028 Barcelona
>> Spain
>> Tel. 34 934095410
>> Fax. 34 934110012
>> email: [hidden email]
>> http://www.ija.csic.es/gt/obster
>>
>> _______________________________________________
>> statsgrass mailing list
>> [hidden email]
>> http://grass.itc.it/mailman/listinfo/statsgrass
>>
>
>
>

--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: [hidden email]

_______________________________________________
statsgrass mailing list
[hidden email]
http://grass.itc.it/mailman/listinfo/statsgrass
Roger Bivand
Economic Geography Section
Department of Economics
Norwegian School of Economics and Business Administration
Helleveien 30
N-5045 Bergen, Norway