I am having a table of polygons with some 15 Mio. records. The polygons hold an attribute called "dn" with integer values between 0 and 6. My goal is to simplify that table so that polygons below a certain size get merged with neighboring ones. First step would be to merge dn=0 polygons of 100 square meters or below with neighboring polygons with dn=1.
The polygons are simple and angular shaped. Resulting from gdal_polygonize.py a raster representation of the data.
My naive attempt was to :
create table temp_union as select 1 as dn, st_union(a_geom,b_geom) from (select geom as a_geom from big_poly_table where dn=1) as foo, (select geom as b_geom from big_poly_table where dn=0 AND st_area(geom)
The polygons are simple and angular shaped. Resulting from gdal_polygonize.py a raster representation of the data.
My naive attempt was to :
create table temp_union as select 1 as dn, st_union(a_geom,b_geom) from (select geom as a_geom from big_poly_table where dn=1) as foo, (select geom as b_geom from big_poly_table where dn=0 AND st_area(geom)