|
POST
|
Open the project properties window and check whether the option "Start external program" selection has been chosen in the Start Action section, and that it points to ArcMap.exe
... View more
03-22-2011
10:38 AM
|
0
|
0
|
2870
|
|
POST
|
2. In ArcGIS Server 10.1 due this summer the server team as made great strides to make web printing better out of the box. As you are still on ArcGIS Server 9.3.1 and 10 has been out for some time now this might be a mute point. Actually, the 10.1 Beta is supposed to be coming out this summer...the final release is scheduled to come out before the 2012 Users Conference.
... View more
03-17-2011
07:59 AM
|
0
|
0
|
846
|
|
POST
|
Hi Greg, I've made a project that integrates the TOC component that Tom Hill created for Flex 3 with the Legend component in a Flash Builder 4 project. As each layer is clicked on and offer, its legend is added or removed. As an added bonus, I have also included the code that will identify features in the visible layers and put them into a single InfoWindow, with the selected features of each layer listed in a datagrid on a separate tab. The forum won't let me upload the project, but the screen shots give you an idea of what it does. Let me know if you'd like to see the project.
... View more
03-03-2011
11:31 AM
|
0
|
0
|
1653
|
|
POST
|
You can pass either a string of the full name of the input object class (C:\Data\table.dbf or C:\Data\test.gdb\testtable) to a geoprocessing tool or a reference to the actual object, but you can't just send the name without the path (table.dbf or testtable). In one tool, CreateFeatureClass, there is a bug (NIM006068) where the template property cannot accept a reference (IDataset::FullName), but will only accept a string of the full path and name of the feature class. Have you examined the results of running the geoprocessing tool (found under the Geoprocessing|Results in the main menu)? Even for processing running in scripts, it will report any errors that may occur and you can figure out what is going wrong with your code. The attached image shows the results of a test application using the geoprocessor.
... View more
03-02-2011
05:18 AM
|
0
|
0
|
713
|
|
POST
|
When my hard drive failed, I lost a number of the compiled SWCs that I had downloaded from the Flex 1.3 code gallery. However, I cannot find them in the Resource Center any more. The links to the specific samples just lead back to the Resource Center home page. And the 9.3 Flex page doesn't contain the code gallery tab any more.
... View more
02-25-2011
06:37 AM
|
0
|
1
|
560
|
|
POST
|
Have you explored the Geoprocessor results to see what is happening with your tool? Here's the Add Field function I use in one of my ArcMap projects. In it, I have created a Global variable for the geoprocessor and have initiated it elsewhere.
AddField(pTable, "Name", "Text", , , 254)
Public Sub AddField(ByVal Input As Object, ByVal FieldName As String, ByVal FieldType As String, Optional ByVal Precision As Long = 0,
Optional ByVal Scale As Long = 0, Optional ByVal Length As Long = 0, Optional ByVal FieldAlias As String = Nothing,
Optional ByVal Nullable As String = "NULLABLE", Optional ByVal Required As String = "NON_REQUIRED", Optional ByVal Domain As String = Nothing)
Dim AddField As New ESRI.ArcGIS.DataManagementTools.AddField
Dim Result As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2
Try
Using releaser As New ESRI.ArcGIS.ADF.ComReleaser
releaser.ManageLifetime(AddField)
AddField.in_table = Input
AddField.field_name = FieldName
AddField.field_type = FieldType
AddField.field_precision = Precision
AddField.field_scale = Scale
AddField.field_length = Length
AddField.field_alias = FieldAlias
AddField.field_is_nullable = Nullable
AddField.field_is_required = Required
AddField.field_domain = Domain
Result = RunTool(AddField, Nothing)
If Result Is Nothing Then
System.Windows.Forms.MessageBox.Show("Could not add field")
End If
End Using
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.ToString, "Add Field error")
End Try
End Sub
Friend Function RunTool(ByVal Process As ESRI.ArcGIS.Geoprocessor.IGPProcess, ByVal TC As ESRI.ArcGIS.esriSystem.ITrackCancel2) As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2
Dim Result As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2
Try
Result = CType(Globals.GP.Execute(Process, Nothing), ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2)
If Result.Status <> ESRI.ArcGIS.esriSystem.esriJobStatus.esriJobSucceeded Then ReturnMessages(Result, "Geoprocessing Error")
Globals.GP.ClearMessages()
Catch ex As Exception
ReturnMessages(Result, "Fail")
System.Windows.Forms.MessageBox.Show(ex.ToString, "Run Geoprocessor")
End Try
Return Result
End Function
Private Sub ReturnMessages(ByVal pResult As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2, ByVal Title As String)
Dim ErrorMessage As String
If pResult.MessageCount > 0 Then
For Count As Integer = 0 To pResult.MessageCount - 1
ErrorMessage += pResult.GetMessage(Count)
Next
End If
System.Windows.Forms.MessageBox.Show(ErrorMessage, Title)
End Sub
... View more
02-25-2011
05:37 AM
|
0
|
0
|
411
|
|
POST
|
Hi Pam, This is code I use in an application (in VB.NET, ArcGIS 9.2) where the user can select whether to merge polygons smaller than a specified area with the largest adjacent polygon or the polygon with the longer adjacent border.
Friend Sub EliminateSlivers(ByVal m_app As ESRI.ArcGIS.Framework.IApplication, ByVal pFLayer As ESRI.ArcGIS.Carto.IFeatureLayer, ByVal MMU As Double, ByVal EliminateType As String)
Dim IsEditing As Boolean = True
Dim pDataset As ESRI.ArcGIS.Geodatabase.IDataset
Dim pEditor As ESRI.ArcGIS.Editor.IEditor
Dim pEditLayers As ESRI.ArcGIS.Editor.IEditLayers
Dim pFCursor As ESRI.ArcGIS.Geodatabase.IFeatureCursor
Dim pFeature As ESRI.ArcGIS.Geodatabase.IFeature
Dim pArea As ESRI.ArcGIS.Geometry.IArea
Dim pAdjFeature As ESRI.ArcGIS.Geodatabase.IFeature
Dim pTopoOp As ESRI.ArcGIS.Geometry.ITopologicalOperator
Try
pDataset = pFLayer
pEditor = m_app.FindExtensionByName("ESRI Object Editor")
If pEditor.EditState <> ESRI.ArcGIS.Editor.esriEditState.esriStateEditing Then
IsEditing = False
pEditor.StartEditing(pDataset.Workspace)
End If
pEditLayers = pEditor
pEditLayers.SetCurrentLayer(pFLayer, 0)
pEditor.StartOperation()
pFCursor = pFLayer.FeatureClass.Search(Nothing, False)
pFeature = pFCursor.NextFeature
Do Until pFeature Is Nothing
pArea = pFeature.Shape
If pArea.Area < MMU Then
If EliminateType = "Border" Then
pAdjFeature = GetLongestBorderAdjacent(pFeature)
Else
pAdjFeature = GetLargestAdjacent(pFeature)
End If
If pAdjFeature IsNot Nothing Then
pTopoOp = pAdjFeature.ShapeCopy
pAdjFeature.Shape = pTopoOp.Union(pFeature.ShapeCopy)
pAdjFeature.Store()
pFeature.Delete()
End If
End If
pFeature = pFCursor.NextFeature
Loop
pEditor.StopOperation("Merge")
If Not IsEditing Then
pEditor.StopEditing(True)
End If
Catch ex As Exception
ExceptionMessage(ex, "Eliminate Slivers")
Finally
Release(pFCursor)
End Try
End Sub
Private Function GetArea(ByVal pArea As ESRI.ArcGIS.Geometry.IArea) As Double
GetArea = pArea.Area
End Function
Public Function GetBorderLen(ByVal pPoly1 As ESRI.ArcGIS.Geometry.IPolygon, ByVal pPoly2 As ESRI.ArcGIS.Geometry.IPolygon) As Double
Dim pTopoOp As ESRI.ArcGIS.Geometry.ITopologicalOperator = pPoly1
Dim pGeo As ESRI.ArcGIS.Geometry.IGeometry = pTopoOp.Intersect(pPoly2, ESRI.ArcGIS.Geometry.esriGeometryDimension.esriGeometry1Dimension)
If Not pGeo.IsEmpty Then
Dim pPoly3 As ESRI.ArcGIS.Geometry.IPolyline = pGeo
Return pPoly3.Length
Else
Return 0.0
End If
End Function
Friend Function GetLargestAdjacent(ByVal pFeat As ESRI.ArcGIS.Geodatabase.IFeature) As ESRI.ArcGIS.Geodatabase.IFeature
Dim pSF As ESRI.ArcGIS.Geodatabase.ISpatialFilter = New ESRI.ArcGIS.Geodatabase.SpatialFilter
Dim pFC As ESRI.ArcGIS.Geodatabase.IFeatureClass
Dim pFCur As ESRI.ArcGIS.Geodatabase.IFeatureCursor
Dim pFeat2 As ESRI.ArcGIS.Geodatabase.IFeature
Dim pLargestFeat As ESRI.ArcGIS.Geodatabase.IFeature
Dim dMaxArea As Double
Try
pSF.Geometry = pFeat.Shape
pSF.SpatialRel = ESRI.ArcGIS.Geodatabase.esriSpatialRelEnum.esriSpatialRelIntersects
pFC = pFeat.Class
pFCur = pFC.Search(pSF, False)
pFeat2 = pFCur.NextFeature
Do Until pFeat2 Is Nothing
If pLargestFeat Is Nothing Then
pLargestFeat = pFeat2
dMaxArea = GetArea(pFeat2.Shape)
Else
If GetArea(pFeat2.Shape) > dMaxArea Then
pLargestFeat = pFeat2
dMaxArea = GetArea(pFeat2.Shape)
End If
End If
pFeat2 = pFCur.NextFeature
Loop
Return pLargestFeat
Catch ex As Exception
ExceptionMessage(ex, "Get Largest Feature")
Return Nothing
End Try
End Function
Public Function GetLongestBorderAdjacent(ByVal pFeat As ESRI.ArcGIS.Geodatabase.IFeature) As ESRI.ArcGIS.Geodatabase.IFeature
Dim pSF As ESRI.ArcGIS.Geodatabase.ISpatialFilter = New ESRI.ArcGIS.Geodatabase.SpatialFilter
Dim pFC As ESRI.ArcGIS.Geodatabase.IFeatureClass
Dim pFCur As ESRI.ArcGIS.Geodatabase.IFeatureCursor
Dim pFeat2 As ESRI.ArcGIS.Geodatabase.IFeature
Dim pLongestBorderFeat As ESRI.ArcGIS.Geodatabase.IFeature
Dim dMaxLen As Double
Try
pSF.Geometry = pFeat.Shape
pSF.SpatialRel = ESRI.ArcGIS.Geodatabase.esriSpatialRelEnum.esriSpatialRelIntersects
pFC = pFeat.Class
pFCur = pFC.Search(pSF, False)
pFeat2 = pFCur.NextFeature
Do Until pFeat2 Is Nothing
If pFeat2.OID <> pFeat.OID Then
If pLongestBorderFeat Is Nothing Then
pLongestBorderFeat = pFeat2
dMaxLen = GetBorderLen(pFeat.Shape, pFeat2.Shape)
Else
If GetBorderLen(pFeat.Shape, pFeat2.Shape) > dMaxLen Then
pLongestBorderFeat = pFeat2
dMaxLen = GetBorderLen(pFeat.Shape, pFeat2.Shape)
End If
End If
End If
pFeat2 = pFCur.NextFeature
Loop
Return pLongestBorderFeat
Catch ex As Exception
ExceptionMessage(ex, "Get Longest Feature")
Return Nothing
Finally
Release(pFCur)
End Try
End Function
... View more
02-08-2011
09:26 AM
|
0
|
0
|
1608
|
|
POST
|
In your OnClick sub, try this:
Dim activeview As ESRI.ArcGIS.Carto.IActiveView = GetActiveViewFromArcMap(My.ArcMap.Application)
Also, you might want to look at the IGxDialog interface. This gives you the ability to load or save many different types of data sets.
... View more
02-08-2011
06:46 AM
|
0
|
0
|
610
|
|
POST
|
What I often do when I write a geoprocessing routine is to first run the tool in ArcMap and examine the results message. This shows the syntax of the parameters that expected by the tool. When you run the Intersect tool, it's expecting several different input feature layers (test1.shp and test2.shp, for example) and their rankings (nothing, in this case), and an output (C:\ArcGIS\Default.gdb\test_Intersect). Here's what the Executing message reports for a test run: "test1 #; test2 #" C:\ArcGIS\Default.gdb\test_Intersect All # INPUT So for the code, you would set in_features to "test1 #; test2 #". All you have to do is supply the names of the dataset and a number for the ranking (or a # if ranking doesn't matter), separated by a semicolon. dim Inter as New ESRI.ArcGIS.AnalysisTools.Intersect Inter.in_features = "test1 #; test2 #" Inter.out_feature_class = "C:\ArcGIS\Default.gdb\test_Intersect"
... View more
02-03-2011
08:47 AM
|
0
|
0
|
1480
|
|
POST
|
This is written in VB.NET and is for another tool, but you should be able to use its logic.
Public Function Clip(ByVal pInFClass As ESRI.ArcGIS.Geodatabase.IFeatureClass, ByVal pClipFClass As ESRI.ArcGIS.Geodatabase.IFeatureClass, ByVal OutputName As String) As ESRI.ArcGIS.Geodatabase.IFeatureClass
Dim Clipper As New ESRI.ArcGIS.AnalysisTools.Clip
Dim Result As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2
Try
Using releaser As New ESRI.ArcGIS.ADF.ComReleaser
releaser.ManageLifetime(Clipper)
Clipper.in_features = pInFClass
Clipper.clip_features = pClipFClass
Clipper.out_feature_class = OutputName
Result = RunTool(Clipper, Nothing)
If Result Is Nothing Then
System.Windows.Forms.MessageBox.Show("Could not clip dataset")
Return Nothing
End If
Return ReturnObjectfromResult(Result, "Feature Class")
End Using
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.ToString, "Clip error")
Return Nothing
End Try
End Function
Private Sub ReturnMessages(ByVal pResult As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2, ByVal Title As String)
Dim ErrorMessage As String
If pResult.MessageCount > 0 Then
For Count As Integer = 0 To pResult.MessageCount - 1
ErrorMessage += pResult.GetMessage(Count)
Next
End If
System.Windows.Forms.MessageBox.Show(ErrorMessage, Title)
End Sub
Friend Function ReturnObjectfromResult(ByVal result As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2, ByVal Type As String) As Object
Dim GPVal As ESRI.ArcGIS.Geodatabase.IGPValue
Dim InMemFC As String
Dim GPUtil As ESRI.ArcGIS.Geoprocessing.IGPUtilities3 = New ESRI.ArcGIS.Geoprocessing.GPUtilities
Try
GPVal = result.GetOutput(0)
InMemFC = GPVal.GetAsText()
Select Case Type
Case "Feature Class"
Return GPUtil.OpenFeatureClassFromString(InMemFC)
Case "Table"
Return GPUtil.OpenTableFromString(InMemFC)
End Select
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.ToString, "Return FeatureClass error")
Return Nothing
End Try
End Function
Friend Function RunTool(ByVal Process As ESRI.ArcGIS.Geoprocessor.IGPProcess, ByVal TC As ESRI.ArcGIS.esriSystem.ITrackCancel2) As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2
Dim Result As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2
Try
'I am using a global variable for the Geoprocessor
Result = CType(Globals.GP.Execute(Process, Nothing), ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2)
If Result.Status <> ESRI.ArcGIS.esriSystem.esriJobStatus.esriJobSucceeded Then ReturnMessages(Result, "Geoprocessing Error")
Globals.GP.ClearMessages()
Catch ex As Exception
ReturnMessages(Result, "Fail")
System.Windows.Forms.MessageBox.Show(ex.ToString, "Run Geoprocessor")
End Try
Return Result
End Function
... View more
02-03-2011
05:03 AM
|
0
|
0
|
1480
|
|
POST
|
It's supposed to be included in the next version coming out in about two weeks (according to a demo at the Federal Users Conference), the Flex and Silverlight versions sometime after that.
... View more
02-03-2011
04:40 AM
|
0
|
0
|
713
|
|
POST
|
ESRI has issued Bug NIM063795 about this behavior. It occurs when the background processing is enabled.
... View more
12-23-2010
02:12 AM
|
0
|
0
|
2687
|
|
POST
|
I'm running a Dissolve (in ArcGIS 10) on a shapefile that doesn't contain the Shape_Area field and am selecting a text field for the dissolve item. It adds Shape_Length and Shape_Area fields to the resultant feature layer and I cannot do anything with those two fields (Delete, run the Field Calculator, or Calculate Geometry). When I export the in-memory feature layer to a shape files, both field are retained as Long fields with a value of 0.
... View more
12-16-2010
05:16 AM
|
0
|
0
|
2686
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | a month ago | |
| 2 | a month ago | |
| 1 | 11-18-2025 12:30 PM | |
| 2 | 11-18-2025 06:53 AM | |
| 1 | 11-17-2025 06:38 AM |
| Online Status |
Offline
|
| Date Last Visited |
yesterday
|