[postgis-users] sum the values of overlapping polygons

Greg Allensworth gregor at greeninfo.org
Wed Jul 2 09:55:29 PDT 2014


You could take the union of them, which would merge the overlapping areas.

SELECT ST_AREA(
    (SELECT ST_UNION(geom) FROM table WHERE whatever=whatever)
) AS area;

Your resulting units would be the same as your projection, e.g. square 
degrees. So you may want to convert to an SRS that preserves area, e.g. 
Albers.

SELECT ST_AREA(ST_TRANSFORM(
    (SELECT ST_UNION(geom) FROM table WHERE whatever=whatever)
    ,
    3083
) AS area;


-g


On 7/2/2014 9:47 AM, Alessandro De Martino wrote:
> Hi,
> I am looking for a way to sum the values of overlapping polygons.
> I have a polygon shapefile with thousands of records and I need to know
> how to sum the values of the polygons when they overlap.
> Thanks!
>
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>


-- 
Greg Allensworth, Senior Web GIS Developer
BS  A+  Network+  Security+  Linux+  Server+

GreenInfo Network - Information and Mapping in the Public Interest
564 Market Street, Suite 510  San Francisco CA 94104
PH: 541-223-7636    email: gregor at greeninfo.org
Web: www.GreenInfo.org     www.MapsPortal.org

Subscribe to MapLines, our e-newsletter, at www.GreenInfo.org


More information about the postgis-users mailing list