I am using the ST_Difference to erase multipolygon feature by a mask. However, the query returns a dssolved multipolygon.
The query is the following:
'''SELECT ST_AsGeoJSON(ST_Collect(geom))::json
FROM (SELECT (
ST_Dump (
ST_Difference(ST_GeomFromGeoJSON('%s'),ST_GeomFromGeoJSON('%s')))).geom)
As f''' % (feature,mask)
Please take a look at those images to understand the problem:
Input:
Dissolved output: