[postgis-users] area() weighted statistics?
Jeff Hamann
jeff.hamann at forestinformatics.com
Fri Oct 10 11:56:50 PDT 2008
I'm trying to create a set of 'unioned' polygons where the statistics
are the area weighted average from the areas of the adjacenct polygons
using PostGIS (which rocks, btw) using something like the following code:
SELECT
( area( GeomUnion( mat2.the_geom ) ) * mat2.initage ) / sum(
area( GeomUnion( mat2.the_geom ) ) ) as wtinitage,
GeomUnion( the_geom ) as boundary
FROM mat2, (SELECT mat2.the_geom FROM mat2 ) AS s;
ch1-# ERROR: aggregate function calls cannot be nested
which would suggest that I cannot perform a query like this:
select area(a.the_geom)*a.attr / sum( area( GeomUnion( a.the_geom ) )
where the denominator is a temp table that contains the unioned
geometries. I'm thinking I might have to perform this process in a few
steps. Is that correct, or is there a 'one-liner' method to union a set
of polygons that touch, such that a set of values can be weighted by
area of the polygons, before the union? I'm having to to this many steps
to make sure, I'm getting correct results, but have lose data when I
geomunion to get a set of touching polygons together.
Thanks
Jeff.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jeff_hamann.vcf
Type: text/x-vcard
Size: 268 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20081010/5f848f86/attachment.vcf>
More information about the postgis-users
mailing list