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 License Initializer generated code.
    m_AOLicenseInitializer.InitializeApplication(New esriLicenseProductCode() {esriLicenseProductCode.esriLicenseProductCodeAdvanced}, _
    New esriLicenseExtensionCode() {})

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

    'get FIPS from user
    Console.WriteLine("FIPS: ")
    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("\\\\dvhqgis02\\d\\David\\natdb\\" & FIPS & "\\" & FIPS & "_1.gdb\\p" & FIPS & ".shp")

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

    'ESRI License Initializer generated code.
    'Do not make any call to ArcObjects after 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?

| improve this question | | | | |

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!

| improve this answer | | | | |

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.