Resolution of the query problem is not displayed (perfect. Create a new layer to indicate the query result)

Source: Internet
Author: User

In the program to improve the efficiency of the method, in the program to complete this task ., You do not need to load 1 million of the data.

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:
Copy the code to your VB or VBA program.
Call the following functions in your program.
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 pgomdef As IGeometryDef
Dim pgomdefedit As IGeometryDefEdit
Set pgomdef = New GeometryDef
Set pgomdefedit = pgomdef
With pgomdefedit
. GeometryType = esriGeometryPolygon
Set. SpatialReference = New UnknownCoordinateSystem
End
Set pFieldEdit. GeometryDef = pgomdef
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
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

 

Create a memory layer in ArcEngine

 

A new feature is added to arcEngine9.2, allowing you to create a memory workspace. When you need such a layer, the attribute data or geometric data of this layer needs to be updated frequently, without the need for efficiency issues, you can consider using the memory layer.
The memory layer is created in five steps:
1. Set attribute Fields
2. Set space reference and geometric Fields
3. Create a memory Workspace
4. Create a feature class in the memory Workspace
5. Create a feature layer and set the feature class created in the previous step to the feature class of the feature layer.

See the complete sample code below

///

/// Create a layer in memory
///

///

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.