[postgis-users] Summarystats (Raster, Polygon)
Duncan Golicher
dgolicher at gmail.com
Fri Nov 16 09:38:46 PST 2012
Thanks again Pierre. I'll work it out from here when I have a chance.
As for PLR I set up some aggregate functions based on the median
example shown here
http://www.bostongis.com/PrinterFriendly.aspx?content_name=postgresql_plr_tut01
create or replace function r_median(_float8)
returns float as 'median(arg1)' language 'plr';
CREATE AGGREGATE median (
sfunc = plr_array_accum,
basetype = float8,
stype = _float8,
finalfunc = r_median
);
So I can have CVs, quartiles etc, just about anything that I want and
even plot histgrams and barplots on the aggregated values (open a
device in a temp directory). That's all inside the database of course,
but as I usually am working on my own research issues and using
PostGIS as an addition to desktop GIS rather than setting things up
for others on a server it is often easier just to pass stuff into R
through RODBC.
Duncan
On Fri, Nov 16, 2012 at 11:27 AM, Pierre Racine
<Pierre.Racine at sbf.ulaval.ca> wrote:
>> Yes, this sounds more or less what I am after and I was thinking along
>> exactly the same lines, especially as with PLR installed I can use R
>> to get more detailed stats for each tile! Great, this sounds really
>> promising. Just one point, how do I return the raster values for each
>> tile to feed into my aggregate stats generator? Sorry to be a bit slow
>> on the uptake here. I am sure that it is all documented, but I am
>> still getting my head around this format.
>
> You mean how to get one field from ST_SummaryStats()? (ST_SummaryStats(rast)).*
>
> You have to UPDATE your table columns with each values returned by ST_SummaryStats().
>
> Is that what you mean?
>
> BTW: do you have a recipe to pass PostGIS rasters to Pl/R? (you are saying you are using R to grab more stats from a tile)
>
> Pierre
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
--
Dr Duncan Golicher
Investigador Titular,
El Colegio de la Frontera Sur, Chiapas,Mexico
Mexico tel +52 1 967 137 94 20
Skype name duncangolicher
Publications: http://www.mendeley.com/profiles/duncan-golicher
Senior lecturer, Bournemouth University, UK
Centre for Conservation Ecology & Environmental Change
School of Applied Sciences
Christchurch House rm C218a
Bournemouth University
Fern Barrow
Poole (Dorset) BH12 5BB UK
Tel. +44 (0)1202 961682
For list of publications see Researcher ID:
http://www.researcherid.com/rid/B-4240-2009
dgolicher at bournemouth.ac.uk
dgoliche at ecosur.mx
Researcher ID:
http://www.researcherid.com/rid/B-4240-2009
More information about the postgis-users
mailing list