hope someone can help me with this... I've been searching for a week or more... can't find an answer...
I just wanted to export a Feature Class to Shapefile so I can try to do a hotspot analysis...
Here is the code that I'm using and getting the error at pExportOperation = New ExportOperation
Dim pMap As IMap = Form1.AxMapControl1.ActiveView.FocusMap
Dim pFeatureLayer As IFeatureLayer = pMap.Layer(0)
'Get the target layer in the map
Dim pFeatureClass As IFeatureClass = pFeatureLayer.FeatureClassDim pFeatureLayerDefinition As IFeatureLayerDefinition = pFeatureLayer ' QI from the FeatureLayer
Dim a As String = pFeatureLayerDefinition.DefinitionExpression.ToString()'Set the where clause
Dim pQueryFilter As IQueryFilter = New QueryFilter
pQueryFilter.WhereClause = a'Get the Featureclassname from the featureclass
Dim pDataset As IDataset = pFeatureClass
Dim pInFeatureClassName As IFeatureClassName = pDataset.FullName
Dim pInDsName As IDatasetName = pInFeatureClassName'Create Directory if doesn't exist
If Directory.Exists("C:\Kernel Density Hotspot") Then
Directory.Delete("C:\Kernel Density Hotspot", True)
End If
Directory.CreateDirectory("C:\Kernel Density Hotspot")'Define the output featureclass
'give it the name of the input feature class + exp
Dim pFeatureClassName As IFeatureClassName = New FeatureClassName
Dim pOutDatasetName As IDatasetName = pFeatureClassName
pOutDatasetName.Name = "Kernel_Density_Export"
Dim pWorkspaceName As IWorkspaceName = New WorkspaceName
pWorkspaceName.PathName = "C:\Kernel Density Hotspot"
pWorkspaceName.WorkspaceFactoryProgID = "esriCore.ShapefileWorkspaceFactory.1"
pOutDatasetName.WorkspaceName = pWorkspaceName'Give the output shapefile the same props as the input dataset
pFeatureClassName.FeatureType = pFeatureClass.FeatureType
pFeatureClassName.ShapeType = pFeatureClass.ShapeType
pFeatureClassName.ShapeFieldName = pFeatureClass.ShapeFieldName'Export selected features
Dim pExportOperation As IExportOperation = Nothing
pExportOperation = New ExportOperationpExportOperation.ExportFeatureClass(pInDsName, pQueryFilter, Nothing, Nothing, pOutDatasetName, 0)
I have used this before in 10.2 now in 10.3 I can't
I have tried True and False Interop
Standalone system checked the binding with ProductCode.EngineOrDesktop and its good
I've tried reinstalling the SDK...
I'm using VS 2013...
I'm just out of ideas...
Solved! Go to Solution.
so after 2 weeks of headbanging on the desk... I have found out the problem...
don't add this both in your code
ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Engine)
ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Desktop)
just use this
ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Desktop)
and everything will be ok...
so after 2 weeks of headbanging on the desk... I have found out the problem...
don't add this both in your code
ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Engine)
ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Desktop)
just use this
ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Desktop)
and everything will be ok...