欢迎您来到GIS动力

加入收藏 免费注册 用户登陆 帮助中心
首页 新闻动态 技术专栏 银杏树下 学习考研 软件下载 求职招聘 许愿瓶 节日祝福 用户中心 精彩推荐 资源搜索 地图
专栏导航: AO开发 | SO开发 | ArcGIS桌面 | 超图桌面 | 开发语言 | 数据库 | WebGIS | 银杏文学 | 研究生考题 | FreeMap 谈天说地
   您现在位于: 首页技术专栏ArcGIS应用与开发AO开发 → 正文
基于Geodatabase数据模型的数据归档
07-11-15 09:15:29 作者:3echo 出处:3echo

ArcGIS 软件向用户提供了数据归档这样一个功能,不知大家是否体验过。最近由于工作的需要,我有幸接触了这一方面的知识。以前我常常为如何去实现历史数据的展示而苦恼,而现在通过 Geodatabase 模型提供的归档操作,就可以轻易地展现以前任意时刻的数据,并以当时的状态进行数据库操作,同时还可以查看任意特定要素在一个时间段里变化。这样一种变化让我有一些欣喜。下面让我们一起来了解一下数据归档的相关内容。 ( 基于 Geodatabase 数据模型的版本机制  

一、什么是数据归档 ?(What is Archiving ?)  

Archiving provides the ability to store all temporal representations of a dataset, writing any changes made to an object to an associated archive table. This object model provides functionality to create historical versions which reference a specific moment in time.  

归档操作向用户提供了这样一个功能:将对归档的要素集(要素类)所做的任何编辑操作保存到相关联的 archive 表。这种对象模型同时也允许用户创建特定时间的历史版本。  

二、 归档 - 如何工作?  

1、   历史信息存储在 Archive 表中  

我们允许对某要素集(要素类)进行归档时,将会创建相应的 Archive 表,并 Copy 一份原有的数据。打开 Archive 表,我们发现其数据结构与原表数据结构并没有什么太大的变化,只是多了三个字段 GDB_FROM_DATE ( 起始时间 ) GDB_TO_DATE (终止时间)、 GDB_ARCHIVE_OID (对象 ID 编号)  

2、   所有对 Default 版本所作的变更都被归档  

理解这一句话很重要,数据归档针对的对象是 Default 版本,所有其子版本所做的变更只有通过提交之后才会被归档,否则不会有什么变化。  

3、   Archive 表含有 from to 日期属性  

4、   Archive 表可直接使用日期属性查询(两种查询方式):  

A、 时间点查询 (Moment in Time Query) :显示某一时间点的所有记录 .  

B、 时间段查询:  

A 时间点到 B 时间点的某一对象所有记录。  

A 时间点到 B 时间点的所有记录。  

5、   ArcDesktop 中如何操作:  

这篇文档中有详细的介绍,大家可以参考:体验ArcGIS9.2的历史库功能  

三、 AE 类图与接口

 

1、   IHistoricalWorkspace 接口与 IHistoricalVersion 接口:

通过类图结构我们可以很清楚地了解它们之间的关系, Workspace 实现了 IHistoricalWorkspace 接口,通过其方法按名称查找版本( FindHistoricalVersionByName() )、按时间戳查找版本( FindHistoricalVersionByTimeStamp() ),我们便可以得到 VersionedWorkspace 对象。通过 VersionedWorkspace 对象我们可以得到 IHistoricalVersion 的引用。下面是 C# 示例代码:

	
		     
			
1 // assuming a reference to a SDE workspace exists
2 IHistoricalWorkspace pHistWorksapce  = mWorkspace  as  IHistoricalWorkspace;
3
4 IHistoricalVersion pHistVersion  =  pHistWorksapce.FindHistoricalVersionByName(“VersionName”);
5

2、   FeatureClass 类与 IHistoricalClass 接口:

FeatureClass 类继承了 IHistoricalClass 接口,通过 IHistoricalClass 接口我们可以很方便地得到该 FeatureClass 相应的归档对象。下面是 C# 示例代码:

1 IArchivableClass pArchivableClass  = pFeatureClass  as  IArchivableClass;
2
3 // 得到归档文件
4 IFeatureLayer pNewFeatLayer = new  FeatureLayerClass();
5
6 pNewFeatLayer.FeatureClass  =  pArchivableClass.Archive  as  IFeatureClass;
7
8

3 EnumHistoricalMarker 类与 HistoricalVersionMarker

1 IArchivableClass pArchivableClass  = pFeatureClass  as  IArchivableClass;
2
3 // 得到归档文件
4 IFeatureLayer pNewFeatLayer = new  FeatureLayerClass();
5
6 pNewFeatLayer.FeatureClass  =  pArchivableClass.Archive  as  IFeatureClass;
7
8

3 EnumHistoricalMarker 类与 HistoricalVersionMarker

历史版本从本质上来讲是历史标识( HistoricalVersionMarker ),其在数据工作空间中的存在相当于一个事务性版本。通过 IHistoricalMarker 接口提供的方法 AddHistoricalMarker 可以实现历史标识的添加。下面是 C# 代码示例:

 1              // assuming a reference to a SDE workspace exists
 2
 3             IHistoricalWorkspace historicalWorkspace  =  (IHistoricalWorkspace)sdeWorkspace;
 4
 5             IEnumHistoricalMarker enumHistoricalMarker  =  historicalWorkspace.HistoricalMarkers;
 6
 7             IHistoricalMarker historicalMarker  =  enumHistoricalMarker.Next();
 8
 9              while  (historicalMarker  !=   null )
10
11              {
12
13                 System.Windows.Forms.MessageBox.Show( "  Name: "   +  historicalMarker.Name  +   "  Time Referenced: "   +  historicalMarker.TimeStamp);
14
15                 historicalMarker  =  enumHistoricalMarker.Next();
16
17          }

18

 1              // assuming a reference to a SDE workspace exists
 2
 3             IHistoricalWorkspace historicalWorkspace  =  (IHistoricalWorkspace)sdeWorkspace;
 4
 5             IEnumHistoricalMarker enumHistoricalMarker  =  historicalWorkspace.HistoricalMarkers;
 6
 7             IHistoricalMarker historicalMarker  =  enumHistoricalMarker.Next();
 8
 9              while  (historicalMarker  !=   null )
10
11              {
12
13                 System.Windows.Forms.MessageBox.Show( "  Name: "   +  historicalMarker.Name  +   "  Time Referenced: "   +  historicalMarker.TimeStamp);
14
15                 historicalMarker  =  enumHistoricalMarker.Next();
16
17          }

18

(本文已被浏览 次)
发布人:admin
推荐给好友:发送给好友
上篇新闻:
下篇新闻:
相关评论
发表我的评论
  • 尊重网上道德,遵守《全国人大常委会关于维护互联网安全的决定》及中华人民共和国其他各项有关法律法;
  • 本站有权保留或删除您发表的任何评论内容;
  •   相关文章  
    Geodatabase中的QueryDef对象
    使用ADO.NET直接连接Geodatabase
    ESRI的Geodatabase数据结构设计指导
    基于Geodatabase数据模型的版本机制
    浅入浅出Oracle Spatial GeoRaster 10g影像数据管理(1
    GIS概念数据模型的研究
    小议Geodatabase

    关于我们 友情链接 ┋ 与我在线 ┋ 管理 ┋ TOP
    网站当前版本:GisPower CMS V3.0
    『GIS 动力』- http://www.gispower.org/
    联系我们:webmaster#gispower.org
    Copyright (c) 2003-2007 GisPOwer.Org. All Rights Reserved.

                   滇ICP备05006901号