|
POST
|
Once you have created your project, you can add these new items by selecting Project from the Visual Studios menu and clicking on "Add New Item".
... View more
08-17-2012
12:30 PM
|
0
|
0
|
598
|
|
POST
|
In your code, before you assign the geometries to the IProximityOperator, you should project each of them into a spatial reference that best fits your data
... View more
08-17-2012
10:37 AM
|
0
|
0
|
1173
|
|
POST
|
Are you zooming to points? If so, take a look at this thread
... View more
08-17-2012
06:21 AM
|
0
|
0
|
993
|
|
POST
|
Try the IPolygon4::ExteriorRingBag
Dim pPolygon As ESRI.ArcGIS.Geometry.IPolygon4 = pPolygonGeometry
Dim pGeoBag As ESRI.ArcGIS.Geometry.IGeometryBag = pPolygon.ExteriorRingBag
Dim pGeoCollection As ESRI.ArcGIS.Geometry.IGeometryCollection = pGeoBag
MsgBox(pGeoCollection.GeometryCount)
... View more
08-16-2012
12:54 PM
|
0
|
0
|
2032
|
|
POST
|
I seem to get the intersecting points fine, my only issue is I cant seem to identify the point on the polygon edge. Getting the first and last point on the intersect point collection is not always the point on the edge of the polygon. That's what I'm still tryingto figure out. It looks like it returns the points from the top to the bottom. I ran a test using the code below on a polygon and line, flashing each point in the geometry collection. The image below shows the direction the line was digitized by the arrows. The upper right intersection point was flashed first. Another question if someone knows the answer is why do I get so many points when I only use the polygon boundary to intersect the polyline. Shouldn�??t it just be two? Is it a polygon with no internal holes? In the sample I ran, I used a donut polygon, which resulted in four intersections. If you look at the help for Boundary, you'll see that it will return all the rings of a polygon, not just the outside boundary.
Dim pLayer As ESRI.ArcGIS.Carto.ILayer2
Dim pLayer1 As ESRI.ArcGIS.Carto.ILayer2
Dim pFLayer As ESRI.ArcGIS.Carto.IFeatureLayer
Dim pFClass As ESRI.ArcGIS.Geodatabase.IFeatureClass
Dim pFCursor As ESRI.ArcGIS.Geodatabase.IFeatureCursor
Dim pFeature As ESRI.ArcGIS.Geodatabase.IFeature
Dim pPolygonGeometry As ESRI.ArcGIS.Geometry.IGeometry
Dim pLineGeometry As ESRI.ArcGIS.Geometry.IGeometry
Dim pTopoOp As ESRI.ArcGIS.Geometry.ITopologicalOperator
Dim pOverlapGeometryCollection As ESRI.ArcGIS.Geometry.IGeometryCollection
Dim pOverlapGeometry As ESRI.ArcGIS.Geometry.IGeometry
Dim pRgbColor As New ESRI.ArcGIS.Display.RgbColor
Using releaser As New ESRI.ArcGIS.ADF.ComReleaser
releaser.ManageLifetime(pFCursor)
pLayer = My.ArcMap.Document.FocusMap.Layer(0)
pFLayer = New ESRI.ArcGIS.Carto.FeatureLayer
pFLayer = pLayer
pFClass = pFLayer.FeatureClass
pFCursor = pFClass.Search(Nothing, False)
pFeature = pFCursor.NextFeature
pLineGeometry = pFeature.Shape
pLayer1 = My.ArcMap.Document.FocusMap.Layer(1)
pFLayer = New ESRI.ArcGIS.Carto.FeatureLayer
pFLayer = pLayer1
pFClass = pFLayer.FeatureClass
pFCursor = pFClass.Search(Nothing, False)
pFeature = pFCursor.NextFeature
pPolygonGeometry = pFeature.Shape
pTopoOp = pPolygonGeometry
pOverlapGeometryCollection = pTopoOp.Intersect(pLineGeometry, ESRI.ArcGIS.Geometry.esriGeometryDimension.esriGeometry0Dimension)
MsgBox(pOverlapGeometryCollection.GeometryCount)
pRgbColor.Red = 255
For j As Integer = 0 To pOverlapGeometryCollection.GeometryCount - 1
pOverlapGeometry = pOverlapGeometryCollection.Geometry(j)
FlashGeometry(pOverlapGeometry, pRgbColor, My.ArcMap.Document.ActiveView.ScreenDisplay, 500) ' this is an ArcGIS snippet
Next
End Using
[ATTACH=CONFIG]17019[/ATTACH]
... View more
08-16-2012
12:12 PM
|
0
|
0
|
2032
|
|
POST
|
Have you tried using the actual GUID of your tool instead? As I understand, the tool has to be on a tollbar or menu somewhere to use the ProgID (CTM.GIS.GISDesktop.CoordinateSelectorTool) UIDCls.Value = "{" & yourClass.ClassId & "}"
... View more
08-16-2012
11:30 AM
|
0
|
0
|
1138
|
|
POST
|
The way I worked with multiple points from an intersection in one of my applications was to use IGeometryCollection, since the intersection returns a multipoint geometry instead of a point geometry. When I tested for overlapping polygons or lines sharing segments, I used IGeometry instead. This shows how I write the intersections to a point feature class.
Dim pOverlapGeometryCollection As ESRI.ArcGIS.Geometry.IGeometryCollection = pTopoOp.Intersect(pInGeometry, ESRI.ArcGIS.Geometry.esriGeometryDimension.esriGeometry0Dimension)
If pOverlapGeometryCollection IsNot Nothing Then
For j As Integer = 0 To pOverlapGeometryCollection.GeometryCount - 1
pOverlapGeometry = pOverlapGeometryCollection.Geometry(j)
pOverlapFeature = pOverlapBuffer
pOverlapFeature.Shape = pOverlapGeometry
pOverlapFeature.Value(pOverlapFeature.Fields.FindField(Field1)) = pFeature.OID
pOverlapFeature.Value(pOverlapFeature.Fields.FindField(Field2)) = pSelFeature.OID
pOverlapFCursor.InsertFeature(pOverlapBuffer)
Next
End If
... View more
08-16-2012
08:23 AM
|
0
|
0
|
2032
|
|
POST
|
This is how I've done it in one of my applications, a Desktop Add-in
The code in my window that contains several drawing options...a buffered point, a polygon, a rectangle, etc. I have another class DrawTool that handles the OnMouseDown action
Private Sub Draw_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPoint.Click, btnPolygon.Click, btnFreehand.Click, btnRectangle.Click
Dim pUID As New ESRI.ArcGIS.esriSystem.UID
Dim pCommandItem As ESRI.ArcGIS.Framework.ICommandItem
Try
pUID.Value = My.ThisAddIn.IDs.DrawTool
pCommandItem = m_application.Document.CommandBars.Find(pUID, False, False)
Select Case sender.name
Case "btnPoint"
'this contains code for specific actions for the point button
Case "btnFreehand"
'this contains code for specific actions for the freehand button
End Select
Me.Visible = False
m_application.CurrentTool = pCommandItem
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.ToString, "Open Draw Feature")
End Try
End Sub
This is the DrawTool class
Public Class DrawTool
Inherits ESRI.ArcGIS.Desktop.AddIns.Tool
Private graphicsContainer As ESRI.ArcGIS.Carto.IGraphicsContainer
Private m_LineFeedback As ESRI.ArcGIS.Display.INewBezierCurveFeedback = Nothing
Protected Overrides Sub OnMouseDown(ByVal arg As ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs)
MyBase.OnMouseDown(arg)
Try
Dim activeView As ESRI.ArcGIS.Carto.IActiveView = My.ArcMap.Document.ActiveView
Dim pGeometry As ESRI.ArcGIS.Geometry.IGeometry5 = GetFeatureFromMouse(activeView, arg.X, arg.Y)
Dim rgbColor As ESRI.ArcGIS.Display.IRgbColor = New ESRI.ArcGIS.Display.RgbColorClass()
Dim FillStyle As ESRI.ArcGIS.Display.esriSimpleFillStyle
rgbColor.Red = 255
FillStyle = ESRI.ArcGIS.Display.esriSimpleFillStyle.esriSFSBackwardDiagonal
If pGeometry Is Nothing Then Exit Sub
AddGraphicToMap(pGeometry, rgbColor, rgbColor, FillStyle) 'this is the ArcGIS snippet "Add Graphic to Map"
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.ToString)
Finally
m_DrawFeature.Visible = True 'This is the form with the buttons
End Try
End Sub
Public Function GetFeatureFromMouse(activeView As ESRI.ArcGIS.Carto.IActiveView, XVal As Integer, YVal As Integer) As ESRI.ArcGIS.Geometry.IGeometry5
Dim screenDisplay As ESRI.ArcGIS.Display.IScreenDisplay = activeView.ScreenDisplay
Dim pRubberBand As ESRI.ArcGIS.Display.IRubberBand2
Dim pPoint As ESRI.ArcGIS.Geometry.IPoint
Dim pPolygon As ESRI.ArcGIS.Geometry.IPolygon4
Dim pGeometry As ESRI.ArcGIS.Geometry.IGeometry5
Dim pPolyLine As ESRI.ArcGIS.Geometry.IPolyline6
Try
Select Case Globals.DrawFeatureType
Case "Point"
pRubberBand = New ESRI.ArcGIS.Display.RubberPoint
pPoint = pRubberBand.TrackNew(screenDisplay, Nothing)
Return pPoint
Case "Polygon"
pRubberBand = New ESRI.ArcGIS.Display.RubberPolygon
pPolygon = pRubberBand.TrackNew(screenDisplay, Nothing)
Return pPolygon
Case "Rectangle"
pRubberBand = New ESRI.ArcGIS.Display.RubberEnvelope
pGeometry = pRubberBand.TrackNew(screenDisplay, Nothing)
Return pGeometry
Case "Freehand"
pPoint = activeView.ScreenDisplay.DisplayTransformation.ToMapPoint(XVal, YVal)
If m_LineFeedback Is Nothing Then
m_LineFeedback = New ESRI.ArcGIS.Display.NewBezierCurveFeedback
m_LineFeedback.Display = screenDisplay
m_LineFeedback.Start(pPoint)
Return Nothing
Else
pPolyLine = m_LineFeedback.Stop
m_LineFeedback = Nothing
pPolygon = CreatePolygonfromPolyline(pPolyLine)
Return pPolygon
End If
Case Else
System.Windows.Forms.MessageBox.Show("Not coded yet")
Return Nothing
End Select
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.ToString, "Get Feature")
Return Nothing
End Try
End Function
Private Function CreatePolygonfromPolyline(pPolyline As ESRI.ArcGIS.Geometry.IPolyline6) As ESRI.ArcGIS.Geometry.IPolygon4
Try
Dim pOutCollection As ESRI.ArcGIS.Geometry.IPointCollection4 = New ESRI.ArcGIS.Geometry.Polygon
Dim pPolygon As ESRI.ArcGIS.Geometry.IPolygon4
pOutCollection.AddPointCollection(pPolyline)
pPolygon = pOutCollection
pPolygon.Close()
Return pPolygon
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.ToString, "Conversion error")
Return Nothing
End Try
End Function
... View more
08-16-2012
07:37 AM
|
0
|
0
|
1138
|
|
POST
|
If you have support with Esri, I would suggest calling them and adding your name onto the bug. If more people let them know this is a problem, they may give it a higher priority.
... View more
08-16-2012
05:51 AM
|
0
|
0
|
2221
|
|
POST
|
There is a bug (NIM061356) on using Python with ICalculator: ICalculator or ICalculatorUI2 do not offer a property where the parser (expression type) can be specified; VBScript is the default, so Python expressions error out. Their suggested workaround is as follows: Below is a workaround that compensates for the lack of being able to specify the parser in ICalculator. It takes advantage of IGeoProcessor and the CalculateField_management geoprocessing tool. The parser or expression_type argument of that tool can be used to specify Python as the parser. '(To test the below VBA code, create a UIButton in VBA and add the code inside the Click event handler of your new UIButton. The second procedure, ReturnMessages(), is called into action by the first procedure towards the very end, but may not be necessary if you do not want to read the messages of the geoprocessing results. Change the first parameter as needed to reflect the correct location of your input table.)
Private Sub UIButtonControl1_Click()
'Create the Geoprocessor
Dim pGp As IGeoProcessor
Set pGp = New GeoProcessor
'Set Overwriteoutput to True
pGp.OverwriteOutput = True
'Add the custom toolbox containing the model tool
'pGp.AddToolbox "C:\CustomTools\custom.tbx"
'Create the Parameter array
Dim pParamArray As IVariantArray
Set pParamArray = New VarArray
'Populate array of parameters
'First Parameter: in_table (e.g. File GDB feature class)
pParamArray.Add "C:\Incidents\845875\Converted_GDB931\downgradedFGDB.gdb\Main_931"
'Second Parameter: field on which to calculate
pParamArray.Add "LastField"
'Third Parameter: expression
pParamArray.Add "math.log1p(!SumOfConcentrations!)"
'Fourth Parameter: expression_type (Optional) !!! !!! !!! !!! !!!
pParamArray.Add "PYTHON_9.3"
Dim pResult As IGeoProcessorResult
'Execute the Model tool
Set pResult = pGp.Execute("CalculateField_management", pParamArray, Nothing)
'Get the returned tool messages
ReturnMessages pResult
End Sub
Public Sub ReturnMessages(ByVal messages As IGeoProcessorResult)
Dim i As Long
Dim message As String
For i = 0 To messages.MessageCount - 1
message = messages.GetMessage(i)
Debug.Print message
Next
End Sub
... View more
08-15-2012
05:14 AM
|
0
|
0
|
2221
|
|
POST
|
If you don't need to worry about overwriting a file, you can set the IGeoprocessor::OverwriteOutput property to true.
... View more
08-14-2012
01:00 PM
|
0
|
0
|
1166
|
|
POST
|
You should add some code to see what the messages in your results variable contain. Here's how I have it in one of my applications.
Dim Result As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2
Dim ErrorMessage As String
Result = CType(GP.Execute(Process, Nothing), ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2)
If Result.Status <> ESRI.ArcGIS.esriSystem.esriJobStatus.esriJobSucceeded Then
If Result.MessageCount > 0 Then
For Count As Integer = 0 To Result.MessageCount - 1
ErrorMessage += Result.GetMessage(Count)
Next
System.Windows.Forms.MessageBox.Show(ErrorMessage, "Geoprocessor failed")
End If
End If
... View more
08-14-2012
11:40 AM
|
0
|
0
|
1166
|
|
POST
|
One of the required properties you have to set for the Buffer tool is the buffer_distance_or_field, either a value or a numeric field. I don't see that property being assigned in your code. Also, when getting an error with one of the geoprocessing tools, the first thing I do is check the results window in ArcMap. It usually tells me why the tool has failed.
... View more
08-14-2012
07:57 AM
|
0
|
0
|
1166
|
|
POST
|
You should take a look at what's being posted on their blog page: http://blogs.esri.com/esri/arcgis/2012/08/10/view-the-arcgis-for-maritime-bathymetry-webinar-video/
... View more
08-14-2012
05:34 AM
|
0
|
0
|
663
|
|
POST
|
This had been submitted as a bug: #NIM083649 IGxDialog:: DoModalSave() with GxFilterFeatureClasses does not always ask user for permission to overwrite when an existing shapefile is chosen. This issue occurs in both 10.0 and 10.1. Esri Support also said that "GxFilterFeatureClasses should work for featureClasses in the mdb and fdb, as well as the shapefiles." I still don't know what that code works properly in another application. In subsequent testing, I found that other filters, such as GxFilterPolygonFeatureClasses or GxFilterPointFeatureClasses, also don't ask for permission to overwrite files for shapefiles or geodatabase feature classes.
... View more
08-10-2012
04:58 AM
|
0
|
0
|
1443
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-04-2025 06:39 AM | |
| 1 | 05-01-2026 08:26 AM | |
| 1 | 04-10-2026 12:01 PM | |
| 1 | 04-13-2026 09:11 AM | |
| 1 | 10-11-2023 06:18 AM |
| Online Status |
Offline
|
| Date Last Visited |
3 weeks ago
|