Join Attributes
1.
IWorkspaceFactory2 workspaceFactory = new ShapefileWorkspaceFactoryClass() as IWorkspaceFactory2;
IWorkspace workspace = workspaceFactory.OpenFromFile(@"E:\", );
IFeatureWorkspace featureWorkspace = (IFeatureWorkspace)workspace;
IFeatureClass featureClass = featureWorkspace.OpenFeatureClass(“a”);
IFeatureClass featureClass2 = featureWorkspace.OpenFeatureClass( "b");
AddJoin aj = new AddJoin();
aj.in_field = "ID";
aj.in_layer_or_view = featureClass2; // @"E:\jhl\" + Functions.g_ROAD + "_SpatialJoin";
aj.join_field = "FID";
aj.join_table = @"E:\a.shp";
//aj.out_layer_or_view = Functions.g_ROAD + "_SpatialJoin";
aj.join_type = "KEEP_ALL";
Geoprocessor gp = new Geoprocessor();
//gp.OverwriteOutput = true;
gp.Execute(aj, null);
2.
//// Build a memory relationship class.
Type memRelClassFactoryType =Type.GetTypeFromProgID("esriGeodatabase.MemoryRelationshipClassFactory");
IMemoryRelationshipClassFactory memRelClassFactory = (IMemoryRelationshipClassFactory)Activator.CreateInstance(memRelClassFactoryType);
IRelationshipClass relationshipClass = memRelClassFactory.Open("a", featureClass2, "ID", (IObjectClass)featureClass,
"FID", "Is Owned By", "Owns",esriRelCardinality.esriRelCardinalityOneToOne);
// Open the RelQueryTable as a feature class.
Type rqtFactoryType =Type.GetTypeFromProgID("esriGeodatabase.RelQueryTableFactory");
IRelQueryTableFactory rqtFactory = (IRelQueryTableFactory)Activator.CreateInstance(rqtFactoryType);
ITable relQueryTable = (ITable)rqtFactory.Open(relationshipClass, false, null,null, string.Empty, false, false);
3.
// Create the query definition.
IQueryDef queryDef = featureWorkspace.CreateQueryDef();
// Provide a list of tables to join.
queryDef.Tables = "a,b";
queryDef.Tables += "";
// Set the subfields and the WhereClause (in this case, the join condition).
queryDef.SubFields = "*";
queryDef.WhereClause = "a.ID = b.FID + 1";
// Make the new TableQueryName.
IQueryName2 queryName2 = (IQueryName2)new TableQueryNameClass();
queryName2.QueryDef = queryDef;
queryName2.PrimaryKey = "ID";
queryName2.CopyLocally = true;
IDataset workspaceDataset = (IDataset)featureWorkspace;
IWorkspaceName workspaceName = (IWorkspaceName)workspaceDataset.FullName;
// Set the workspace and name of the new QueryTable.
IDatasetName datasetName = (IDatasetName)queryName2;
datasetName.WorkspaceName = workspaceName;
datasetName.Name = "Join";
// Open the virtual table.
IName name = (IName)queryName2;
ITable table = (ITable)name.Open();
Join Attributes的更多相关文章
- Arcgis, ArcEngine, Arcgis Server使用开发汇总 索引
ArcGIS系列软件license及安装: Arcgis SDE10.1 和 Arcgis server10.1的授权文件license tnt_esri.dat Arcgis8.1安装license ...
- HANA SQLScript
数据类型 日期时间类型 DATE(日期) DATE 数据类型由年.月.日信息组成,表示一个日期值. DATA 类型的默认格式为‘YYYY-MM-DD’. YYYY 表示年, MM 表示月而 DD 表示 ...
- HTML解析类 ,让你不使用正则也能轻松获取HTML相关元素 -C# .NET
功能: 1.轻松获取指元素HTML元素. 2.可以根据属性标签进行筛选 3.返回的都是Llist强类型无需转换 用过XElement的都知道 用来解析XML非常的方便,但是对于HTML的格式多样化实在 ...
- Octopus系列之开发过程各个技术点
自定义了页面周期 使用唯一的一个VelocityEngine全局的静态实例,优化了小泥鳅blog中每次请求都要创建VelocityEngine实例对象,减少了对象的开销 通过UA判断请求来自的设备,从 ...
- EMC题2
易安信笔试题分享:1 protected成员函数能被肿么调用2 “has-a” relationship是指的啥,答案有instance, reference, pointer等...3 int, c ...
- cratedb joins 原理(官方文档)
JOINs are essential operations in relational databases. They create a link between rows based on c ...
- Data Management Technology(2) -- Data Model
1.Data Model Model Is the abstraction of real world Reveal the essence of objects, help people to lo ...
- perl使用print输入数据到文件
#!usr/bin/perl use utf8; #引入utf8模块 脚本内的字符串使用utf8作为编码格式 binmode(STDOUT,":encoding(gbk)"); # ...
- Delete,Update与LEFT Join
UPDATE:UPDATE A SET ApproverID=NULL FROM [SH_MaterialApplyBuyBill] A LEFT JOIN [SH_MaterialApplyBuyB ...
随机推荐
- MySQL行锁深入研究
原文:http://blog.csdn.net/minipeach/article/details/5325161/ 做项目时由于业务逻辑的需要,必须对数据表的一行或多行加入行锁,举个最简单的例子,图 ...
- java弱引用之WeakHashMap相关资料
本人博客中有一篇文章对java中的引用有详细的介绍[http://www.cnblogs.com/javaee6/p/4763190.html],java中WeakHashMap这个类就是java弱引 ...
- MongoDB官方C#驱动中查询条件Query用法
Query.All("name", "a", "b");//通过多个元素来匹配数组 Query.And(Query.EQ("nam ...
- insertion sort(插入排序)
#include<stdio.h> #include<time.h> int insertion_sort() { ; int a[max],i,j; srand((unsig ...
- 理解 OpenStack 高可用(HA)(1):OpenStack 高可用和灾备方案 [OpenStack HA and DR]
本系列会分析OpenStack 的高可用性(HA)概念和解决方案: (1)OpenStack 高可用方案概述 (2)Neutron L3 Agent HA - VRRP (虚拟路由冗余协议) (3)N ...
- 洛谷P3388 【模板】割点
给出一个n个点,m条边的无向图,求图的割点. u是cut vertex的两个条件: 1.存在v使v及其所有后代没有反向边连回u的祖先 2.u是根且有两个以上子节点 dfs一遍 low[u]是u及其后代 ...
- java操作Redis
需要使用如下jar包 <!-- https://mvnrepository.com/artifact/redis.clients/jedis --> <dependency> ...
- Winform布局方式
一.默认布局 ★可以加panel,也可以不加: ★通过鼠标拖动控件的方式,根据自己的想法布局.拖动控件的过程中,会有对齐的线,方便操作: ★也可选中要布局的控件,在工具栏中有对齐工具可供选择,也有调整 ...
- PhpStorm XDebug 远程调试
现在我们自己公司的各种开发和测试服务器,都是使用阿里云的服务器.一些PHP的项目,无法在本地搭建完整的环境,在外网服务器上调试更方便定位问题.发现网上没有完整的关于如何配置PHPStorm和XDebu ...
- Java通过ODBC链接数据库并遍历结果的一个问题
上一篇文章谈到怎么连接Oracle数据库,其实通过ODBC也差不多,只是driver要换成JdbcOdbcDriver.配置文件如下: driver=sun.jdbc.odbc.JdbcOdbcDri ...