|
POST
|
Make sure you're adding the correct reference. You have to add it using the Add Reference.. tool instead of the Add ArcGIS Reference.. When that dialog is opened, look for the ESRI.ArcGIS.Geoprocessor component.
... View more
05-24-2011
05:21 AM
|
0
|
0
|
473
|
|
POST
|
You can reference another add in component with the following code Dim pUID As New ESRI.ArcGIS.esriSystem.UID Dim pCommandItem As ESRI.ArcGIS.Framework.ICommandItem pUID.Value = My.ThisAddIn.IDs.DrawTool 'DrawTool is the name of my addin tool...yours will be different pCommandItem = m_application.Document.CommandBars.Find(pUID, False, False)
... View more
05-23-2011
06:23 AM
|
0
|
0
|
1133
|
|
POST
|
If you're using ArcGIS 10, then you can use the Data Driven pages to do this. If you're using ArcGIS 9.x, check out my script to do this.
... View more
05-20-2011
10:50 AM
|
0
|
0
|
1034
|
|
POST
|
Please note that the ArcGIS Viewer for Flex forum has been created for the Flex Viewer and Widget code questions.
... View more
05-18-2011
06:56 AM
|
0
|
0
|
367
|
|
POST
|
Please note that the ArcGIS Viewer for Flex forum has been set up for your Flex Viewer issues.
... View more
05-17-2011
10:56 AM
|
0
|
0
|
347
|
|
POST
|
Thanks, Sean. This is what my code now looks like
Public Class DrawTool
Inherits ESRI.ArcGIS.Desktop.AddIns.Tool
Private m_LineFeedback As ESRI.ArcGIS.Display.INewBezierCurveFeedback = Nothing
Public Sub New()
End Sub
Protected Overrides Sub OnUpdate()
End Sub
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 rgbColor As ESRI.ArcGIS.Display.IRgbColor = New ESRI.ArcGIS.Display.RgbColorClass()
Dim pGeometry As ESRI.ArcGIS.Geometry.IGeometry5 = GetFeatureFromMouse(activeView, arg.X, arg.Y)
If pGeometry Is Nothing Then Exit Sub
rgbColor.Red = 255
'Add the user's drawn graphics as persistent on the map.
AddGraphicToMap(activeView.FocusMap, pGeometry, rgbColor, rgbColor)
'Best practice: Redraw only the portion of the active view that contains graphics.
activeView.PartialRefresh(ESRI.ArcGIS.Carto.esriViewDrawPhase.esriViewGraphics, Nothing, Nothing)
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.ToString)
End Try
End Sub
Protected Overrides Sub OnMouseMove(arg As ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs)
MyBase.OnMouseMove(arg)
Try
If m_LineFeedback IsNot Nothing Then
Dim pPoint As ESRI.ArcGIS.Geometry.IPoint = My.ArcMap.Document.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(arg.X, arg.Y)
m_LineFeedback.AddPoint(pPoint)
End If
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.ToString)
End Try
End Sub
Public Sub AddGraphicToMap(ByVal map As ESRI.ArcGIS.Carto.IMap, ByVal geometry As ESRI.ArcGIS.Geometry.IGeometry, ByVal rgbColor As ESRI.ArcGIS.Display.IRgbColor, ByVal outlineRgbColor As ESRI.ArcGIS.Display.IRgbColor)
Dim graphicsContainer As ESRI.ArcGIS.Carto.IGraphicsContainer = CType(map, ESRI.ArcGIS.Carto.IGraphicsContainer) ' Explicit Cast
Dim element As ESRI.ArcGIS.Carto.IElement = Nothing
graphicsContainer.DeleteAllElements()
If (geometry.GeometryType) = ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint Then
' Marker symbols
Dim simpleMarkerSymbol As ESRI.ArcGIS.Display.ISimpleMarkerSymbol = New ESRI.ArcGIS.Display.SimpleMarkerSymbolClass()
simpleMarkerSymbol.Color = rgbColor
simpleMarkerSymbol.Outline = True
simpleMarkerSymbol.OutlineColor = outlineRgbColor
simpleMarkerSymbol.Size = 8
simpleMarkerSymbol.Style = ESRI.ArcGIS.Display.esriSimpleMarkerStyle.esriSMSCross
Dim markerElement As ESRI.ArcGIS.Carto.IMarkerElement = New ESRI.ArcGIS.Carto.MarkerElementClass()
markerElement.Symbol = simpleMarkerSymbol
element = CType(markerElement, ESRI.ArcGIS.Carto.IElement) ' Explicit Cast
ElseIf (geometry.GeometryType) = ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline Then
' Line elements
Dim simpleLineSymbol As ESRI.ArcGIS.Display.ISimpleLineSymbol = New ESRI.ArcGIS.Display.SimpleLineSymbolClass()
simpleLineSymbol.Color = rgbColor
simpleLineSymbol.Style = ESRI.ArcGIS.Display.esriSimpleLineStyle.esriSLSSolid
simpleLineSymbol.Width = 5
Dim lineElement As ESRI.ArcGIS.Carto.ILineElement = New ESRI.ArcGIS.Carto.LineElementClass()
lineElement.Symbol = simpleLineSymbol
element = CType(lineElement, ESRI.ArcGIS.Carto.IElement) ' Explicit Cast
ElseIf geometry.GeometryType = ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon Then
' Polygon elements
Dim simpleFillSymbol As ESRI.ArcGIS.Display.ISimpleFillSymbol = New ESRI.ArcGIS.Display.SimpleFillSymbolClass()
simpleFillSymbol.Color = rgbColor
simpleFillSymbol.Style = ESRI.ArcGIS.Display.esriSimpleFillStyle.esriSFSForwardDiagonal
Dim fillShapeElement As ESRI.ArcGIS.Carto.IFillShapeElement = New ESRI.ArcGIS.Carto.PolygonElementClass()
fillShapeElement.Symbol = simpleFillSymbol
element = CType(fillShapeElement, ESRI.ArcGIS.Carto.IElement) ' Explicit Cast
ElseIf geometry.GeometryType = ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryEnvelope Then
Dim simpleFillSymbol As ESRI.ArcGIS.Display.ISimpleFillSymbol = New ESRI.ArcGIS.Display.SimpleFillSymbolClass()
simpleFillSymbol.Color = rgbColor
simpleFillSymbol.Style = ESRI.ArcGIS.Display.esriSimpleFillStyle.esriSFSForwardDiagonal
Dim fillShapeElement As ESRI.ArcGIS.Carto.IFillShapeElement = New ESRI.ArcGIS.Carto.RectangleElementClass
fillShapeElement.Symbol = simpleFillSymbol
element = CType(fillShapeElement, ESRI.ArcGIS.Carto.IElement) ' Explicit Cast
End If
If Not (element Is Nothing) Then
Try
element.Geometry = geometry
graphicsContainer.AddElement(element, 0)
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.ToString)
End Try
End If
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
End Class
... View more
05-11-2011
08:36 AM
|
0
|
0
|
1123
|
|
POST
|
The Times method will only take two inputs, so what you'll have to do is create a new pMathOp and use pOutRaster as the first input and the third raster as the second input.
... View more
05-11-2011
04:52 AM
|
0
|
0
|
470
|
|
POST
|
I'm creating an Add-in that lets a user select the type of feature to draw on the map. I've gotten the code for adding points, polygons, and rectangles, but I'd like to add in the capability of drawing polygons in freehand mode. Is there way of doing that? Here's my existing code for the drawing tool
Public Class DrawTool
Inherits ESRI.ArcGIS.Desktop.AddIns.Tool
Public Sub New()
End Sub
Protected Overrides Sub OnUpdate()
End Sub
Protected Overrides Sub OnMouseDown(ByVal arg As ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs)
MyBase.OnMouseDown(arg)
Dim activeView As ESRI.ArcGIS.Carto.IActiveView = My.ArcMap.Document.ActiveView
Dim rgbColor As ESRI.ArcGIS.Display.IRgbColor = New ESRI.ArcGIS.Display.RgbColorClass()
Dim pGeometry As ESRI.ArcGIS.Geometry.IGeometry5 = GetFeatureFromMouse(activeView)
rgbColor.Red = 255
'Add the user's drawn graphics as persistent on the map.
AddGraphicToMap(activeView.FocusMap, pGeometry, rgbColor, rgbColor)
'Best practice: Redraw only the portion of the active view that contains graphics.
activeView.PartialRefresh(ESRI.ArcGIS.Carto.esriViewDrawPhase.esriViewGraphics, Nothing, Nothing)
End Sub
Public Sub AddGraphicToMap(ByVal map As ESRI.ArcGIS.Carto.IMap, ByVal geometry As ESRI.ArcGIS.Geometry.IGeometry, ByVal rgbColor As ESRI.ArcGIS.Display.IRgbColor, ByVal outlineRgbColor As ESRI.ArcGIS.Display.IRgbColor)
Dim graphicsContainer As ESRI.ArcGIS.Carto.IGraphicsContainer = CType(map, ESRI.ArcGIS.Carto.IGraphicsContainer) ' Explicit Cast
Dim element As ESRI.ArcGIS.Carto.IElement = Nothing
graphicsContainer.DeleteAllElements()
If (geometry.GeometryType) = ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint Then
' Marker symbols
Dim simpleMarkerSymbol As ESRI.ArcGIS.Display.ISimpleMarkerSymbol = New ESRI.ArcGIS.Display.SimpleMarkerSymbolClass()
simpleMarkerSymbol.Color = rgbColor
simpleMarkerSymbol.Outline = True
simpleMarkerSymbol.OutlineColor = outlineRgbColor
simpleMarkerSymbol.Size = 8
simpleMarkerSymbol.Style = ESRI.ArcGIS.Display.esriSimpleMarkerStyle.esriSMSCross
Dim markerElement As ESRI.ArcGIS.Carto.IMarkerElement = New ESRI.ArcGIS.Carto.MarkerElementClass()
markerElement.Symbol = simpleMarkerSymbol
element = CType(markerElement, ESRI.ArcGIS.Carto.IElement) ' Explicit Cast
ElseIf (geometry.GeometryType) = ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline Then
' Line elements
Dim simpleLineSymbol As ESRI.ArcGIS.Display.ISimpleLineSymbol = New ESRI.ArcGIS.Display.SimpleLineSymbolClass()
simpleLineSymbol.Color = rgbColor
simpleLineSymbol.Style = ESRI.ArcGIS.Display.esriSimpleLineStyle.esriSLSSolid
simpleLineSymbol.Width = 5
Dim lineElement As ESRI.ArcGIS.Carto.ILineElement = New ESRI.ArcGIS.Carto.LineElementClass()
lineElement.Symbol = simpleLineSymbol
element = CType(lineElement, ESRI.ArcGIS.Carto.IElement) ' Explicit Cast
ElseIf (geometry.GeometryType) = ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon Then
' Polygon elements
Dim simpleFillSymbol As ESRI.ArcGIS.Display.ISimpleFillSymbol = New ESRI.ArcGIS.Display.SimpleFillSymbolClass()
simpleFillSymbol.Color = rgbColor
simpleFillSymbol.Style = ESRI.ArcGIS.Display.esriSimpleFillStyle.esriSFSForwardDiagonal
Dim fillShapeElement As ESRI.ArcGIS.Carto.IFillShapeElement = New ESRI.ArcGIS.Carto.PolygonElementClass()
fillShapeElement.Symbol = simpleFillSymbol
element = CType(fillShapeElement, ESRI.ArcGIS.Carto.IElement) ' Explicit Cast
End If
If Not (element Is Nothing) Then
element.Geometry = geometry
graphicsContainer.AddElement(element, 0)
End If
End Sub
Public Function GetFeatureFromMouse(activeView As ESRI.ArcGIS.Carto.IActiveView) As ESRI.ArcGIS.Geometry.IGeometry5
Dim screenDisplay As ESRI.ArcGIS.Display.IScreenDisplay = activeView.ScreenDisplay
Dim pPointSymbol As New ESRI.ArcGIS.Display.MarkerFillSymbol
Dim pRGBColor As New ESRI.ArcGIS.Display.RgbColor
Dim pPolygonSymbol As New ESRI.ArcGIS.Display.SimpleFillSymbol
Dim pOutline As New ESRI.ArcGIS.Display.SimpleLineSymbol
Dim pRubberBand As ESRI.ArcGIS.Display.IRubberBand2
Dim pGeometry As ESRI.ArcGIS.Geometry.IGeometry5
Try
Select Case Globals.DrawFeatureType
Case "Point"
pRubberBand = New ESRI.ArcGIS.Display.RubberPoint
Case "Polygon"
pRubberBand = New ESRI.ArcGIS.Display.RubberPolygon
Case "Rectangle"
pRubberBand = New ESRI.ArcGIS.Display.RubberEnvelope
Case "Freehand"
System.Windows.Forms.MessageBox.Show("Freehand not coded yet")
Return Nothing
Case Else
System.Windows.Forms.MessageBox.Show("Not coded yet")
Return Nothing
End Select
pGeometry = pRubberBand.TrackNew(screenDisplay, Nothing)
Return pGeometry
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.ToString, "Get Feature")
Return Nothing
End Try
End Function
End Class
... View more
05-10-2011
01:21 PM
|
0
|
2
|
3754
|
|
POST
|
Unfortunately, this is not a bug. It's been an issue since the ArcGIS 8.x days. I was able to work around this problem by checking the current task in the EditorEvents_OnSketchFinished sub: If LCase(m_pEditor.CurrentTask.Name) = "auto-complete polygon" Then
... View more
05-10-2011
06:01 AM
|
0
|
0
|
318
|
|
POST
|
One way of doing this would be to run a summary on each attribute. This will give you a table for each attribute that lists each unique value and its count. Join those two tables to the original table and make a selection based on the count fields.
... View more
05-04-2011
07:32 AM
|
0
|
0
|
260
|
|
POST
|
The samples for Flex 1.3 API and Flex 3 are found here.
... View more
05-03-2011
11:12 AM
|
0
|
0
|
304
|
|
POST
|
It turns out we had to add the Fully Qualified Domain Name to the machine account using the command netdom computername localhost /add <fqdn> Here's a few things that might help your debugging. If you're testing the service using the same service name, are you clearing the REST cache after making changes to the service? Are the changes reflected in the Services Directory? For example, for the dynamic layer does http://local/ArcGIS/rest/services/socioeco/cz_blocks2000/MapServer show "Single Fused Map Cache: false" when it is being used as "dynamic"? Does it work when viewed in ArcGIS JavaScript, try http://local/ArcGIS/rest/services/socioeco/cz_blocks2000/MapServer?f=jsapi When it fails, does httpfox (or charles/fiddler) show any errors?
... View more
04-15-2011
10:10 AM
|
0
|
0
|
585
|
|
POST
|
We are having the same problem with compact cache files. When I view the service as a dynamic layer, it shows up properly. If I create exploded cache files and view it as a tiled layer, it shows up properly. If I create compact cache files and view it as a tiled layer, it doesn't show up. The spatial reference shouldn't make a different here since I'm only viewing the single layer in the following code
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:esri="http://www.esri.com/2008/ags"
pageTitle="A tiled map service">
<esri:Map>
<esri:ArcGISDynamicMapServiceLayer url="http://local/ArcGIS/rest/services/socioeco/cz_blocks2000/MapServer"/>
<!--<esri:ArcGISTiledMapServiceLayer url="http://local/ArcGIS/rest/services/socioeco/cz_blocks2000/MapServer"/>-->
</esri:Map>
</s:Application>
... View more
04-15-2011
06:54 AM
|
0
|
0
|
585
|
|
POST
|
Have you tried using the ESRI.ArcGIS.ADF.ComReleaser? Here's an example of one of my geoprocessing subroutines.
Friend Sub DeleteObject(ByVal pInObject As Object)
Dim Delete As New ESRI.ArcGIS.DataManagementTools.Delete
Dim Result As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2
Try
Using releaser As New ESRI.ArcGIS.ADF.ComReleaser
releaser.ManageLifetime(Delete)
Delete.in_data = pInObject
Result = RunTool(Delete, Nothing)
If Result Is Nothing Then
System.Windows.Forms.MessageBox.Show("Could not delete object")
End If
End Using
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.ToString, "Delete error")
End Try
End Sub
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 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(GP.Execute(Process, Nothing), ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2)
If Result.Status <> ESRI.ArcGIS.esriSystem.esriJobStatus.esriJobSucceeded Then ReturnMessages(Result, "Geoprocessing Error")
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
04-13-2011
06:56 AM
|
0
|
0
|
1193
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | a month ago | |
| 2 | 12-17-2025 11:04 AM | |
| 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 |
Friday
|