IGeoselect Interface (Geoselect)

Example

Provides access to members that implements publish, import and change data operations

Product Availability

Available with ArcGIS Desktop

Members

ChangeDatasources

Changes datasources of all layers of the current document 
Sub
ChangeDatasources(ByVal pMxDocument As IMxDocument, ByVal DatasourceArray() As TDataSource)

ImportData

Imports data from another document
Sub ImportData(ByVal OutputDocPath As String, ByVal ImportedDocPath As String, Optional ByVal pMxDocument As IMxDocument = Nothing)

Publish

Transfers datasets of the layers in current project to specified place (Geodatabase, Folders e.g)
Sub Publish(ByVal SourceFile As String, ByVal TargetFile As String, ByVal SpatialOption As Boolean, ByVal ConvertTo As EnumConvertTo, Optional ByVal SdeName As String = "", Optional ByVal SdePass As String = "")

Brief arguments description:

OutputDocPath – path to output project

ImportedDocPath – project path to be imported

SourceFile – path to project to be published

TargetFile – path to output project

SpatialOptionFalse if you want to project all features to coordinate system of the frame, it’s True otherwise.

ConvertTo – indicates output dataset type (feature class, SDE feature class or shapefile)

SdeName – name of SDE user

SdePass – password of SDE user

 

CoClasses:

ClsGeoselect CoClass (Geoselect)

Geoselect class

 

EnumConvertTo Constants

 

Public Enum EnumConvertTo

    EnumConvertTo _enumConvertToFeatureClass = 1                      ‘ Converts to feature classes

    EnumConvertTo _enumConvertToSDEFeatureClass = 2                ‘ Converts to SDE feature classes

    EnumConvertTo _enumConvertToShapefile = 3                            ‘ Converts to shapefiles

End Enum

 

TDataSource Structure (Type)

 

Public Structure TDataSource

    Dim OldDataSource As String            ‘ Old datasource path

    Dim NewDataSource As String          ‘ New datasourse path

    Dim Type As String                           Datasource type

End Structure

 

Example:

 Dim pGxFile As IGxFile
        Dim pDialog As IGxDialog
        Dim pGxFilter As New GxFilterMaps
        Dim pEnumObject As IGxObjectArray
        Set pDialog = New GxDialog
        Set pDialog.ObjectFilter = pGxFilter
        If pDialog.DoModalOpen(0, pEnumObject) Then
         Set pGxFile = pEnumObject.Item(0)
         Dim StrArr() As String
         Set pDialog = New GxDialog
         Set pDialog.ObjectFilter = pGxFilter
         StrArr = Split(pGxFile.Path, "\", , vbTextCompare)
         pDialog.Name = StrArr(UBound(StrArr))
         If pDialog.DoModalSave(0) Then
          Dim GS As IGeoselect
          Set GS = New ClsGeoselect
          GS.Publish pGxFile.Path, pDialog.FinalLocation.FullName & "\" & pDialog.Name, True,numConvertTo.EnumConvertTo_enumConvertToFeatureClass
         End If
        End If
End Sub