不显示查询问题的解决(太完美了,新建一个图层,表示查询结果)
2009-03-02 16:09
459 查看
在程序里完成,提高效率的方法,在程序面上完成这个任务。,不用把100万的数据加载进来。
CreateFeatureClass Method (esriGeoDatabase)
Example
Creates a new standalone feature class under the workspace.
Syntax
Set variable = object.CreateFeatureClass (Name, Fields, CLSID, EXTCLSID, FeatureType, ShapeFieldName, ConfigKeyword )
The CreateFeatureClass method syntax has the following object qualifier and arguments:
Part Description
object An object expression that evaluates to an object in the Applies To list.
variable A reference to an object that implements IFeatureClass.
Name Required. A string expression that represents the Name.
Fields Required. An IFields object.
CLSID Required. An IUID object.
EXTCLSID Required. An IUID object.
FeatureType Required. An esriFeatureType constant whose value represents the FeatureType.
ShapeFieldName Required. A string expression that represents the ShapeFieldName.
ConfigKeyword Required. A string expression that represents the ConfigKeyword.
How to use:
拷贝代码到你的 VB 或者 VBA 程序里.
在你的程序里Call下面的函数.
Public Sub CreateShapefile()
Const strFolder As String = "D:"Data"
Const strName As String = "MyShapeFile" ' Dont include .shp extension
Const strShapeFieldName As String = "Shape"
' Open the folder to contain the shapefile as a workspace
Dim pFWS As IFeatureWorkspace
Dim pWorkspaceFactory As IWorkspaceFactory
Set pWorkspaceFactory = New ShapefileWorkspaceFactory
Set pFWS = pWorkspaceFactory.OpenFromFile(strFolder, 0)
' Set up a simple fields collection
Dim pFields As IFields
Dim pFieldsEdit As IFieldsEdit
Set pFields = New esriCore.Fields
Set pFieldsEdit = pFields
Dim pField As IField
Dim pFieldEdit As IFieldEdit
' Make the shape field
' it will need a geometry definition, with a spatial reference
Set pField = New esriCore.Field
Set pFieldEdit = pField
pFieldEdit.Name = strShapeFieldName
pFieldEdit.Type = esriFieldTypeGeometry
Dim pGeomDef As IGeometryDef
Dim pGeomDefEdit As IGeometryDefEdit
Set pGeomDef = New GeometryDef
Set pGeomDefEdit = pGeomDef
With pGeomDefEdit
.GeometryType = esriGeometryPolygon
Set .SpatialReference = New UnknownCoordinateSystem
End With
Set pFieldEdit.GeometryDef = pGeomDef
pFieldsEdit.AddField pField
' Add another miscellaneous text field
Set pField = New esriCore.Field
Set pFieldEdit = pField
With pFieldEdit
.Length = 30
.Name = "MiscText"
.Type = esriFieldTypeString
End With
pFieldsEdit.AddField pField
' Create the shapefile
' (some parameters apply to geodatabase options and can be defaulted as Nothing)
Dim pFeatClass As IFeatureClass
Set pFeatClass = pFWS.CreateFeatureClass(strName, pFields, Nothing, _
Nothing, esriFTSimple, strShapeFieldName, "")
End Sub
在ArcEngine中创建内存图层
arcEngine9.2中新增了一个新的特征,允许创建内存工作空间。当你需要一个这样的图层时,这个图层的属性数据或者几何数据需要频繁的更新,而又不希望因此而带来效率上的问题,你就可以考虑使用内存图层。
内存图层的创建分为五步:
1、设置属性字段
2、设置空间参考和几何字段
3、创建内存工作空间
4、在内存工作空间中创建特征类
5、创建特征图层,并将上一步创建的特征类设置为这个特征的图层的特征类
请看以下完整的示例代码
///
/// 在内存中创建图层
///
///
CreateFeatureClass Method (esriGeoDatabase)
Example
Creates a new standalone feature class under the workspace.
Syntax
Set variable = object.CreateFeatureClass (Name, Fields, CLSID, EXTCLSID, FeatureType, ShapeFieldName, ConfigKeyword )
The CreateFeatureClass method syntax has the following object qualifier and arguments:
Part Description
object An object expression that evaluates to an object in the Applies To list.
variable A reference to an object that implements IFeatureClass.
Name Required. A string expression that represents the Name.
Fields Required. An IFields object.
CLSID Required. An IUID object.
EXTCLSID Required. An IUID object.
FeatureType Required. An esriFeatureType constant whose value represents the FeatureType.
ShapeFieldName Required. A string expression that represents the ShapeFieldName.
ConfigKeyword Required. A string expression that represents the ConfigKeyword.
How to use:
拷贝代码到你的 VB 或者 VBA 程序里.
在你的程序里Call下面的函数.
Public Sub CreateShapefile()
Const strFolder As String = "D:"Data"
Const strName As String = "MyShapeFile" ' Dont include .shp extension
Const strShapeFieldName As String = "Shape"
' Open the folder to contain the shapefile as a workspace
Dim pFWS As IFeatureWorkspace
Dim pWorkspaceFactory As IWorkspaceFactory
Set pWorkspaceFactory = New ShapefileWorkspaceFactory
Set pFWS = pWorkspaceFactory.OpenFromFile(strFolder, 0)
' Set up a simple fields collection
Dim pFields As IFields
Dim pFieldsEdit As IFieldsEdit
Set pFields = New esriCore.Fields
Set pFieldsEdit = pFields
Dim pField As IField
Dim pFieldEdit As IFieldEdit
' Make the shape field
' it will need a geometry definition, with a spatial reference
Set pField = New esriCore.Field
Set pFieldEdit = pField
pFieldEdit.Name = strShapeFieldName
pFieldEdit.Type = esriFieldTypeGeometry
Dim pGeomDef As IGeometryDef
Dim pGeomDefEdit As IGeometryDefEdit
Set pGeomDef = New GeometryDef
Set pGeomDefEdit = pGeomDef
With pGeomDefEdit
.GeometryType = esriGeometryPolygon
Set .SpatialReference = New UnknownCoordinateSystem
End With
Set pFieldEdit.GeometryDef = pGeomDef
pFieldsEdit.AddField pField
' Add another miscellaneous text field
Set pField = New esriCore.Field
Set pFieldEdit = pField
With pFieldEdit
.Length = 30
.Name = "MiscText"
.Type = esriFieldTypeString
End With
pFieldsEdit.AddField pField
' Create the shapefile
' (some parameters apply to geodatabase options and can be defaulted as Nothing)
Dim pFeatClass As IFeatureClass
Set pFeatClass = pFWS.CreateFeatureClass(strName, pFields, Nothing, _
Nothing, esriFTSimple, strShapeFieldName, "")
End Sub
在ArcEngine中创建内存图层
arcEngine9.2中新增了一个新的特征,允许创建内存工作空间。当你需要一个这样的图层时,这个图层的属性数据或者几何数据需要频繁的更新,而又不希望因此而带来效率上的问题,你就可以考虑使用内存图层。
内存图层的创建分为五步:
1、设置属性字段
2、设置空间参考和几何字段
3、创建内存工作空间
4、在内存工作空间中创建特征类
5、创建特征图层,并将上一步创建的特征类设置为这个特征的图层的特征类
请看以下完整的示例代码
///
/// 在内存中创建图层
///
///
相关文章推荐
- 在使用Hibernate时,因为一个查询需要更多的表连接而要使用SQL来解决性能问题。然而返回的结果集中包含了没有映射的Entity类中的表字段,在这个SQL中还有使用如何将层次关系的父子结点显示为横行
- 多个表联合查询的一些问题解决,用一个表里面的查询结果来排除另外一个表的查询结果
- 通用解决方案:解决NHibernate SELECT 多表查询结果List绑定控件显示问题。
- MySQL 中文显示乱码以及中文查询条件返回0条结果的问题解决
- dataGridView1.DataSource,解决查询结果不从第一行显示,而是不断往表下面扩展问题
- 解决 oracle查询时char类型为character只显示一个字符的问题
- 如何解决ADO.NET访问Access数据库出现"操作必须使用一个可更新的查询"的问题(非原创,摘自书中)
- Toast优化,解决频繁点击一个按钮,toast会一直显示,不能立即消失的问题
- 解决同一个局域网两个DHCP冲突问题--涉及到局域网IP扫描,主机操作系统扫描,mac地址查询
- 问题:C#打开一个文本文档往里面写数据,没有就新建文档 ;结果:c#FileStream文件读写(转)
- mysql 查询结果 导出 excel格式并解决乱码问题
- 学习笔记之Arcgis server开发中identify查询结果显示问题
- Activity task问题(二)解决方法:把入口Activity设成singleTask,新建一个task
- JS实现是一个文本框(值为参数)输入另一个显示(查询结果)
- 关于ASP.NET“操作必须使用一个可更新的查询”问题的解决方法
- ListView中只显示一个item问题解决方法
- 解决CxGrid Filter 后,通过 Dataset 循环时得出的结果与 Grid显示不同步的问题.
- 解决同一个标签只能显示一次提示信息的问题
- 调试PCB板中,结果短路了,这是一个非常纠结的问题,写下解决经验