[postgis-users] Calculate area of raster/polygon intersections in PostGIS

Pierre Racine Pierre.Racine at sbf.ulaval.ca
Thu Apr 16 12:17:55 PDT 2015


> 1 - What's the best way to do raster/polygon intersections? I read about
> two different approaches, one using ST_Intersection and the other one
> using ST_Clip. The second one apparently is faster and more efficient, but i
> don't know about its precision.

The precision depends on the sizes of your pixels comparing with the size of your buffers. If pixels are relatively small you should get a good precision. If pixels are big precision will be poor and in that case you could use the ST_Intersection method. But be careful at false precision... 

> 2 - Assuming that i used ST_Clip to do the intersections, the result it's
> gonna be another raster. How can i calculate the area of each category of
> this raster?

Use ST_ValueCount() times the size of one pixel (make sure to be projected properly).

Pierre


More information about the postgis-users mailing list