postgresql - PostGIS 等效于 ArcMap Union
问题描述
PostGIS / PostgreSQL中 ArcMap中“联合”操作的等价物是什么?
假设您有两个 shapefile,每个具有两个特征。(PostGIS 等效项:两个表,两行,多边形几何)
那么结果将是 1 个具有 7 个特征的 shapefile。(PostGIS 等效项:具有 7 行几何形状的表格)
我查看了 ST_Intersect、ST_Union 和 ST_Collect,但找不到正确的组合。非常感谢您的帮助。
解决方案
这是一个基于gis.stackexchange的答案的工作查询:
从 a) 到 d) 阅读它:
-- d) Extract the path number and the geom from the geometry dump
SELECT
(dump).path[1] id,
(dump).geom
FROM
(
-- c) Polygonize the unioned rings (returns a GEOMETRYCOLLECTION)
-- Dump them to return individual geometries
SELECT
ST_Dump(ST_Polygonize(geom)) dump
FROM
(
-- b) Union all rings in one big geometry
SELECT
ST_Union(geom) geom
FROM
(
-- a) First get the exterior ring from all geoms
SELECT
ST_ExteriorRing(geom) geom
FROM
rectangles
) a
) b
) c
结果:
推荐阅读
- c# - Helix Toolkit WPF,单击鼠标更改相机矢量
- sql-server - 从 csv 文件批量插入
- c# - COMException with interopServices C# in Excel only with xlsx
- keycloak - 登录后keycloak不断刷新
- c++ - 当我将工具按钮动态添加到 QMainWindow 的 mainToolBar 时,我不希望 QDockwidget 调整大小
- kubernetes - 如何限制对某些 Kubernetes 命名空间的访问,只允许某些 pod 访问?
- python - 迭代列的条件以查找其他列值
- ios - TouchMoved not called for customized GesturesRecognizer
- r - 使用 pairwise_count 在 R 中创建关系矩阵
- c# - 如何在 CSOM Project Server 中获取自定义字段任务的值