-1

I am creating a ArcGIS console application using ArcGIS 10.2 and Visual Studio 2010. I need to project a shapefile to a new location (.gdb) using console inputs and the Project tool within the Data Management toolbox. Code below:

Imports ESRI.ArcGIS.esriSystem
Imports ESRI.ArcGIS.Geoprocessing
Imports ESRI.ArcGIS.DataManagementTools
Module Module1
Private m_AOLicenseInitializer As LicenseInitializer = New preInGen.LicenseInitializer()

<STAThread()> _
Sub Main()
    'load product code and version to version manager
    ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Desktop)

    'ESRI License Initializer generated code.
    m_AOLicenseInitializer.InitializeApplication(New esriLicenseProductCode() {esriLicenseProductCode.esriLicenseProductCodeAdvanced}, _
    New esriLicenseExtensionCode() {})

    'get state abbreviation from user
    Console.WriteLine("State abbreviation: ")
    Console.Write(">")
    Dim StAbb As String = Console.ReadLine()

    'get FIPS from user
    Console.WriteLine("FIPS: ")
    Console.Write(">")
    Dim FIPS As String = Console.ReadLine()

    'create new geoprocesor
    Dim gp As IGeoProcessor = New GeoProcessor
    gp.OverwriteOutput = True

    'create parameter inputs
    Dim param As IVariantArray = New VarArray
    param.Add("\\\\prhqgis01\\f\\arcgisserver\\MapMS2_Data\\Parcel_Boundaries\\" & StAbb & "\\p" & FIPS & ".shp")
    param.Add("GCD_WGC_1984")
    param.Add("\\\\dvhqgis02\\d\\David\\natdb\\" & FIPS & "\\" & FIPS & "_1.gdb\\p" & FIPS & ".shp")
    param.Add("GCS_North_American_1983")
    param.Add("WGS_1984_(ITRF00)_To_NAD_1983")

    'project parcel file
    gp.Execute("Project_management", param, Nothing)

    'ESRI License Initializer generated code.
    'Do not make any call to ArcObjects after ShutDownApplication()
    m_AOLicenseInitializer.ShutdownApplication()
End Sub

End Module

When I do a test run, I get a generic COM exception: "Error HRESULT E_FAIL has been returned from a call to a COM component."

Can anyone help me find the exact source of the error?

2

The order of parameters is incorrect. Have a look at the Project tool help page, your parameter order must be the same as this.

Also what is "GCD_WGC_1984"? To my knowledge that's not a coordinate system, I'm guessing you meant GCS_WGS_1984? But that's academic as your parameters are out of order!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.