I have a dataset with two layers of polygons:
Layer A: Areas of interest from the corine land cover inventory dataset
Layer B: Road network resulting from buffered linestrings that were aggregated by st_union (in combination with st_dump to expand the multipolygon)
I want to subtract layer B from layer A by using st_difference. My SQL query looks like this:
CREATE TABLE diff AS SELECT st_difference(clc.geom, roads.geom) AS geom FROM clc, roads WHERE st_intersects(clc.geom, roads.geom);
Somehow the output of st_difference results in multiple overlapping polygons and some of them are the result of the difference and some are not.
Layer A and B do not have multiple overlapping polygons themselves.