I am using PostGIS on pgAdmin3 (PostgreSQL 9.3 e PostGIS 2.2). I have a shapefile with more than 500.000 features and I want to merge them into one.
The geometries are MultiPolygon.
I would like to have as output a shapefile with the same geometry's complexity like the input. I Have to simply the geometry after a merge...
I used several codes but none of them seem to work.
All these queries do not return what I would aspect: I have a table with the same number of feature than before.
CREATE TABLE test1 AS SELECT gid, fid, (ST_DUMP(geom)).geom AS geom FROM land_polygons;
CREATE TABLE test2 AS SELECT 1::INT as gid, ST_Buffer(ST_Collect(geom),0)::geometry(MultiPolygon,4326) FROM land_polygons;
CREATE TABLE test3 AS SELECT gid, fid, ST_GeometryN(geom, generate_series(1, ST_NumGeometries(geom))) AS geom FROM land_polygons
CREATE TABLE test4 AS SELECT ST_Union(ST_SnapToGrid(geom,0.0001)) FROM land_polygons;
I do not know what I could do more...