I have defined a view in postgres that returns a set of polygons and can be queried as follows:-
SELECT wkb_geometry, grade_count FROM ng_schema.grade_count_report [sql.where] order by grade_count asc
This returns me a set of polygons with varying values of grade_count
What I want to do next is find geometries that overlap and cut out the overlap from the geometry that has the lower grade_count. Where they were equal I would cut the geometry with the largest area.
How best to do this?