POST
|
sorry duncan i don't think i have tried using iGeoProcessor... i was hoping that i can insert some code in between maybe but i don't know what... 😄 ' Open the source and target workspaces. Dim sourceWorkspacePath As String = "C:\\temp" Dim targetWorkspacePath As String = "C:\Maps.gdb" Dim sourceWorkspaceFactory As IWorkspaceFactory = New ShapefileWorkspaceFactoryClass() Dim targetWorkspaceFactory As IWorkspaceFactory = New FileGDBWorkspaceFactoryClass() Dim sourceWorkspace As IWorkspace = sourceWorkspaceFactory.OpenFromFile(sourceWorkspacePath, 0) Dim targetWorkspace As IWorkspace = targetWorkspaceFactory.OpenFromFile(targetWorkspacePath, 0) ' Cast the workspaces to the IDataset interface and get name objects. Dim sourceWorkspaceDataset As IDataset = CType(sourceWorkspace, IDataset) Dim targetWorkspaceDataset As IDataset = CType(targetWorkspace, IDataset) Dim sourceWorkspaceDatasetName As IName = sourceWorkspaceDataset.FullName Dim targetWorkspaceDatasetName As IName = targetWorkspaceDataset.FullName Dim sourceWorkspaceName As IWorkspaceName = CType(sourceWorkspaceDatasetName, IWorkspaceName) Dim targetWorkspaceName As IWorkspaceName = CType(targetWorkspaceDatasetName, IWorkspaceName)
... View more
06-16-2013
06:51 PM
|
0
|
0
|
14
|
POST
|
how can i add a feature dataset in the target location? someone? please... 🙂
... View more
06-13-2013
10:34 PM
|
0
|
0
|
14
|
POST
|
how can i import a shapefile to FGDB dataset? hope someone can help me with this... i have tried the code below... but it only export a feature class from FGDB to a shapefile Public Shared Sub ConvertFeatureClassToShapefile()
' Open the source and target workspaces.
Dim sourceWorkspacePath As String = "C:\Map.gdb\"
Dim sourceWorkspaceFactory As IWorkspaceFactory = New FileGDBWorkspaceFactoryClass()
Dim sourceWorkspace As IWorkspace = sourceWorkspaceFactory.OpenFromFile(sourceWorkspacePath, 0)
Dim targetWorkspacePath As String = "C:\Temp"
Dim targetWorkspaceFactory As IWorkspaceFactory = New ShapefileWorkspaceFactoryClass()
Dim targetWorkspace As IWorkspace = targetWorkspaceFactory.OpenFromFile(targetWorkspacePath, 0)
' Cast the workspaces to the IDataset interface and get name objects.
Dim sourceWorkspaceDataset As IDataset = CType(sourceWorkspace, IDataset)
Dim sourceWorkspaceDatasetName As IName = sourceWorkspaceDataset.FullName
Dim sourceWorkspaceName As IWorkspaceName = CType(sourceWorkspaceDatasetName, IWorkspaceName)
Dim targetWorkspaceDataset As IDataset = CType(targetWorkspace, IDataset)
Dim targetWorkspaceDatasetName As IName = targetWorkspaceDataset.FullName
Dim targetWorkspaceName As IWorkspaceName = CType(targetWorkspaceDatasetName, IWorkspaceName)
' Create a name object for the shapefile and cast it to the IDatasetName interface.
Dim sourceFeatureClassName As IFeatureClassName = New FeatureClassNameClass()
Dim sourceDatasetName As IDatasetName = CType(sourceFeatureClassName, IDatasetName)
sourceDatasetName.Name = "road"
sourceDatasetName.WorkspaceName = sourceWorkspaceName
' Create a name object for the FGDB feature class and cast it to the IDatasetName interface.
Dim targetFeatureClassName As IFeatureClassName = New FeatureClassNameClass()
Dim targetDatasetName As IDatasetName = CType(targetFeatureClassName, IDatasetName)
targetDatasetName.Name = "road"
targetDatasetName.WorkspaceName = targetWorkspaceName
' Open source feature class to get field definitions.
Dim sourceName As IName = CType(sourceFeatureClassName, IName)
Dim sourceFeatureClass As IFeatureClass = CType(sourceName.Open(), IFeatureClass)
' Create the objects and references necessary for field validation.
Dim fieldChecker As IFieldChecker = New FieldCheckerClass()
Dim sourceFields As IFields = sourceFeatureClass.Fields
Dim targetFields As IFields = Nothing
Dim enumFieldError As IEnumFieldError = Nothing
' Set the required properties for the IFieldChecker interface.
fieldChecker.InputWorkspace = sourceWorkspace
fieldChecker.ValidateWorkspace = targetWorkspace
' Validate the fields and check for errors.
fieldChecker.Validate(sourceFields, enumFieldError, targetFields)
If Not enumFieldError Is Nothing Then
' Handle the errors in a way appropriate to your application.
Console.WriteLine("Errors were encountered during field validation.")
End If
' Find the shape field.
Dim shapeFieldName As String = sourceFeatureClass.ShapeFieldName
Dim shapeFieldIndex As Integer = sourceFeatureClass.FindField(shapeFieldName)
Dim shapeField As IField = sourceFields.Field(shapeFieldIndex)
' Get the geometry definition from the shape field and clone it.
Dim geometryDef As IGeometryDef = shapeField.GeometryDef
Dim geometryDefClone As IClone = CType(geometryDef, IClone)
Dim targetGeometryDefClone As IClone = geometryDefClone.Clone()
Dim targetGeometryDef As IGeometryDef = CType(targetGeometryDefClone, IGeometryDef)
' Create a query filter to remove ramps, interstates and highways.
'Dim queryFilter As IQueryFilter = New QueryFilterClass()
'queryFilter.WhereClause = "NAME <> 'Ramp' AND PRE_TYPE NOT IN ('I', 'Hwy')"
' Create the converter and run the conversion.
Dim featureDataConverter As IFeatureDataConverter = New FeatureDataConverterClass()
Dim enumInvalidObject As IEnumInvalidObject = featureDataConverter.ConvertFeatureClass(sourceFeatureClassName, Nothing, Nothing, targetFeatureClassName, targetGeometryDef, targetFields, "", 1000, 0)
' Check for errors.
enumInvalidObject.Reset()
Dim invalidObjectInfo As IInvalidObjectInfo = enumInvalidObject.Next()
Do While Not invalidObjectInfo Is Nothing
' Handle the errors in a way appropriate to the application.
Console.WriteLine("Errors occurred for the following feature: {0}", invalidObjectInfo.InvalidObjectID)
Loop
End Sub
... View more
06-13-2013
07:44 PM
|
0
|
7
|
1598
|
POST
|
http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#//0023000000nq000000 sorry but i don't see anything related to entity data model in that link... or i just don't know what you mean...
... View more
03-18-2013
01:03 AM
|
0
|
0
|
7
|
POST
|
Add a Try...Catch with some error checking. Or at minimum, step through and determine the exact line it is failing on. have tried adding try catch... still getting an error in this line... COMException was unhandled by user code Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED)) m_dockableWindow = dockWindowManager.GetDockableWindow(windowID) ' <-----on this line but if i remove the ADO.NET Entity Data Model the error won't appear...
... View more
02-18-2013
04:21 PM
|
0
|
0
|
7
|
POST
|
i have tried using ADO.NET Entity Data Model in my ArcDesktop project using dockable windows. but every time i start debugging im getting a error. COMException was unhandled by user code Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))
Private Sub SetupDockableWindow()
If m_dockableWindow Is Nothing Then
Dim dockWindowManager As IDockableWindowManager
dockWindowManager = CType(m_application, IDockableWindowManager)
If Not dockWindowManager Is Nothing Then
Dim windowID As UID = New UIDClass
windowID.Value = regKey.GetValue("dwUID") 'DockableWindowGuid
m_dockableWindow = dockWindowManager.GetDockableWindow(windowID) ' <-----on this line
End If
End If
End Sub
... View more
02-17-2013
10:53 PM
|
0
|
4
|
356
|
POST
|
hi, im trying to creat a custom toolbar with tools for arcmap. i have a combobox in it and added some codes in the ComboBox1_SelectedIndexChange() to remove all layers. here's the code added private sub ComboBox1_SelectedIndexChange() removeLayers() end sub sub removeLayers() Dim pMxDoc as IMxDocument = DirectCast(m_Application.Document, IMxDocument) Dim pMap as IMap = pMxDoc.FocusMap pMap.ClearLayers() pMxDoc.UpdateContents() pMxDoc.ActiveView.Refresh() end sub but when I start debugging to test if the code is working I get the error NullReferenceException was unhandled bu user code Object reference not set to an instance of an object. can someone help me with this... i'm using VS2008 and arcgis 9.3
... View more
06-08-2011
07:22 PM
|
0
|
0
|
566
|
Online Status |
Offline
|
Date Last Visited |
12-01-2020
03:33 AM
|