我必须根据多点输入功能创建溶解的缓冲区。在下面的示例中,输入表包含4个功能。要素#2
由两个点几何组成。创建缓冲区后,我得到了4个多边形几何:
有没有一种将结果分组的方法?点#1
和的缓冲区#2
已溶解,应为单个多面要素(a
)。
到目前为止,我所做的是:
-- collect all buffers to a single multi-polygon feature
-- dissolve overlapping polygon geometries
CREATE TABLE public.pg_multibuffer AS SELECT
row_number() over() AS gid,
sub_qry.*
FROM (SELECT
ST_Union(ST_Buffer(geom, 1000, 8))::geometry(MultiPolygon, /*SRID*/) AS geom
FROM
public.multipoints)
AS sub_qry;
编辑:
-- create sample geometries
CREATE TABLE public.multipoints (
gid serial NOT NULL,
geom geometry(MultiPoint, 31256),
CONSTRAINT multipoints_pkey PRIMARY KEY (gid)
);
CREATE INDEX sidx_multipoints_geom
ON public.multipoints
USING gist
(geom);
INSERT INTO public.multipoints (gid, geom) VALUES
(1, ST_SetSRID(ST_GeomFromText('MultiPoint(12370 361685)'), 31256)),
(2, ST_SetSRID(ST_GeomFromText('MultiPoint(13520 360880, 19325 364350)'), 31256)),
(3, ST_SetSRID(ST_GeomFromText('MultiPoint(11785 367775)'), 31256)),
(4, ST_SetSRID(ST_GeomFromText('MultiPoint(19525 356305)'), 31256));