ArcSDE 版本差异提取

ArcGIS通过版本化技术管理多人编辑的事务记录,其桌面软件ArcMap和Pro都提供了版本管理工具。其中对两个版本之间的差异对比需求,可以通过ArcMap或Pro提供的VersionChange功能进行查看。下图是在Pro中使用该功能的截图。

 

该功能十分便捷,但却无法把差异批量导出为表格或要素。下文将介绍如何直接从SDE数据库导出指定版本间的差异。

以PostgresSQL ArcSDE空间数据库为示例,poi为一个已经注册为版本化的点要素图层,假设已经创建好了一个版本“Ver1”,现在对比默认版本和Ver1版本的差异。具体步骤如下:

1、 创建版本物化视图。

示例代码:

select sde.sde_set_current_version('DEFAULT');

create materialized view poidefault as

SELECT * from poi_evw;

select sde.sde_set_current_version('Ver1');

create materialized view poiv1 as

SELECT * from poi_evw;

2、 查询Ver1版本更新的记录。

示例代码:

select v1.*

from poidefault d,poiv1 v1

where d.objectid = v1.objectid and not st_equals(d.shape,v1.shape)

3、 查询Ver1版本新增的记录。

示例代码:

select v1.*

from poiv1 v1

where v1.objectid not in (select d.objectid from poidefault d)

4、 查询Ver1版本删除的记录。

示例代码:

select d.*

from poidefault d

where d.objectid not in (select v1.objectid from poiv1 v1)

原文地址:https://www.cnblogs.com/luwl/p/15128708.html