合并功能n时间

时间:2017-09-29 17:00:22

标签: postgresql merge postgis

这是我的问题,我正在进行一个供水项目,我必须合并代表管道的线路特征,如果它们具有相同的构造材料并且它们相互接触。合并是两两完成的,这意味着某些功能将在某些情况下重复,如下图所示:

enter image description here

这显示了我的问题。在合并之后,我将获得三条记录,但我想要的只是一条记录,其中包含填充where子句中的条件的整个管道:

以下是帮助我进行合并的查询:

drop table if exists touches_material;
create table touches_material as 
select   distinct a.*,
st_Union(a.geom,b.geom) as fusion  from pipe a, pipe b
where  a.id < b.id and a.material = b.material  and  
st_touches(a.geom,b.geom) 
group by a.id,a.geom,b.geom

以下图片显示了测试数据的预期结果,它是通过QGIS GIS软件实现的: enter image description here

但这就是我&#39;得到我的疑问:
enter image description here

如果您对如何实现我所援引的目标有任何了解,我将非常感谢您的回答。最好的祝福。

0 个答案:

没有答案