博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Join Attributes
阅读量:6758 次
发布时间:2019-06-26

本文共 2951 字,大约阅读时间需要 9 分钟。

1.

IWorkspaceFactory2 workspaceFactory = new ShapefileWorkspaceFactoryClass() as IWorkspaceFactory2;            IWorkspace workspace = workspaceFactory.OpenFromFile(@"E:\", 0);            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();

 

 

转载地址:http://clweo.baihongyu.com/

你可能感兴趣的文章
手动创建数据库操作步骤
查看>>
yum配置与使用
查看>>
Spring+Struts 2 简单实例报空指针异常
查看>>
正则表达式测试器
查看>>
innobackupex 部分表恢复
查看>>
兼容IE,Firefox,CSS3 opacity透明度
查看>>
读取Hive中所有表的表结构,并在新Hive库中创建表,索引等
查看>>
XenServer部署系列之02——系统安装及许可
查看>>
linux下FTP服务器搭建
查看>>
XenServer pool 移除server 设置master
查看>>
python调用不同目录下的方法
查看>>
程序的查询 ps - 笔记1
查看>>
Conversion to Dalvik format failed with error 1的又一种情形
查看>>
nodejs抓取数据二(列表解析)
查看>>
TextView中实现可点击链接的显示
查看>>
HAOI 树上操作
查看>>
深刻理解Python中的元类(metaclass)以及元类实现单例模式
查看>>
java随机生成n个不相同的整数
查看>>
DIV+CSS基础
查看>>
使用JS完成首页定时弹出广告图片
查看>>