|
POST
|
As Anthony mentioned, you'll just have to restart your service after saving the mxd, not trying to re-publish the service with the same name. In addition, you might have to login to the REST Admin if you're not using ArcGIS 10.1 yet (http://yourmapservice/ArcGIS/rest/admin) and clear the cache. See here for more information.
... View more
12-27-2012
05:04 AM
|
0
|
0
|
8812
|
|
POST
|
Here's the code I use to get the output from a geoprocessing tool. In this case, I'm running a Dissolve with the output being a string of the final location. This string is used in the function ReturnObjectfromResult, which can return a feature class, feature layer, or a table. Friend Function DissolveDataset(ByVal InputName As Object, ByVal DissolveField As String, ByVal StatsFields As String, ByVal OutputName As String) As ESRI.ArcGIS.Geodatabase.IFeatureClass Dim DissolveDS As New ESRI.ArcGIS.DataManagementTools.Dissolve Dim Result As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2 Try Using releaser As New ESRI.ArcGIS.ADF.ComReleaser releaser.ManageLifetime(DissolveDS) DissolveDS.in_features = InputName DissolveDS.dissolve_field = DissolveField DissolveDS.statistics_fields = StatsFields DissolveDS.out_feature_class = OutputName Result = RunTool(DissolveDS, Nothing) If Result Is Nothing Then System.Windows.Forms.MessageBox.Show("Could not dissolve dataset") Return Nothing End If Return ReturnObjectfromResult(Result, "Feature Class") End Using Catch ex As Exception System.Windows.Forms.MessageBox.Show(ex.ToString, "Dissolve error") Return Nothing End Try End Function Private Sub ReturnMessages(ByVal pResult As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2, ByVal Title As String) If pResult Is Nothing Then Exit Sub 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) Case "Feature Layer" Return GPUtil.OpenFeatureLayerFromString(InMemFC) Case Else Return Nothing End Select Catch ex As Exception System.Windows.Forms.MessageBox.Show(ex.ToString, "ReturnObjectfromResult error") Return Nothing End Try End Function Friend Function RunTool(ByVal Process As ESRI.ArcGIS.Geoprocessor.IGPProcess, ByVal TC As ESRI.ArcGIS.esriSystem.ITrackCancel2, Optional ByVal AddOutput As Boolean = False) As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2 Dim Result As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2 Try System.Windows.Forms.Cursor.Current = Windows.Forms.Cursors.WaitCursor Dim GP As New ESRI.ArcGIS.Geoprocessor.Geoprocessor GP.AddOutputsToMap = AddOutput GP.OverwriteOutput = True 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
12-27-2012
04:44 AM
|
0
|
0
|
1037
|
|
POST
|
One of my applications uses a modal form for the user to populate the attributes of the feature. I do this in the OnCreateFeature event. However, the OnCreateFeature doesn't get fired when using the Auto-Complete Polygon tool, so in the OnSketchFinished event, I check whether the user is using that tool and use a modal dialog there, also Private Sub OnSketchFinished()
Dim AttribSelForm As New AttributeSelectionForm
Dim pEditTask As ESRI.ArcGIS.Editor.IEditTask
Dim pEditTaskSearch As ESRI.ArcGIS.Editor.IEditTaskSearch = My.ArcMap.Editor
pEditTask = pEditTaskSearch.TaskByUniqueName("TitusUI_AutoCompletePolygonTask")
If My.ArcMap.Editor.CurrentTask Is pEditTask Then
AttribSelForm.ShowDialog(System.Windows.Forms.Control.FromHandle(My.ArcMap.Application.hWnd))
... View more
12-20-2012
04:51 AM
|
0
|
0
|
1384
|
|
POST
|
Glad to help! Don't forget to mark the question as answered.
... View more
12-17-2012
11:31 AM
|
0
|
0
|
919
|
|
POST
|
Set the graphic's tooltip, not the layer's tooltip myGraphic.toolTip = myGraphic.attributes.PATSUB_SUB_KEY; Sub_Gra_Layer.add(myGraphic);
... View more
12-17-2012
11:24 AM
|
0
|
0
|
919
|
|
POST
|
Web maps usually use Web Mercator projection, which is generally bad for doing measurements. Take a look at this blog posting, which goes into much greater detail about this. The post has a link to an application that shows the difference when using a Web Mercator projection and ones more suitable for length and area.
... View more
12-12-2012
10:10 AM
|
0
|
0
|
1104
|
|
POST
|
Here's how to do it for an addin in VB.Net MyFormInstanceName.Show(System.Windows.Forms.Control.FromHandle(My.ArcMap.Application.hWnd)) Thanks to Jim Isbell for this
... View more
12-06-2012
04:54 AM
|
0
|
0
|
2328
|
|
POST
|
One of the drawbacks of ArcGIS.com is that there doesn't seem to be a good category for scripts. The help page listing the items you can upload seems to focus on finished items, like addins. It's definitely more difficult to find things on the new ArcGIS.com than in ArcScripts. I've gotten many emails from people asking if I've updated some of my tools and I have to point them to the exact spot. I've noticed that the tools on ArcGIS.com I've posted are getting downloaded at a much slower rate than on ArcScripts.
... View more
11-29-2012
05:22 AM
|
0
|
0
|
2106
|
|
POST
|
Here's one way to do it. Private Sub readFieldFromFeature(ByVal path As String, ByRef inputarray As String()) Try Dim factory As ESRI.ArcGIS.Geodatabase.IWorkspaceFactory = New ESRI.ArcGIS.DataSourcesFile.ShapefileWorkspaceFactory Dim workspace As ESRI.ArcGIS.Geodatabase.IFeatureWorkspace = DirectCast(factory.OpenFromFile(System.IO.Path.GetDirectoryName(path), 0), ESRI.ArcGIS.Geodatabase.IFeatureWorkspace) Dim fields As ESRI.ArcGIS.Geodatabase.IFields = workspace.OpenFeatureClass(System.IO.Path.GetFileNameWithoutExtension(path)).Fields Dim fieldcount As Integer = fields.FieldCount ReDim inputarray(fieldcount - 1) For i As Integer = 0 To fieldcount - 1 inputarray(i) = fields.Field(i).Name Next Catch ex As Exception MsgBox(ex.ToString) End Try End Sub
... View more
11-26-2012
04:53 AM
|
0
|
0
|
1401
|
|
POST
|
I have to disagree with you, Alexander. If you try to get the length of an array that was initialized but nothing added to it, you'll get the error message "System.NullReferenceException: Object reference not set to an instance of an object."
Dim strArray As String()
Try
Dim test As Integer = strArray.Length
Catch ex As Exception
MsgBox(ex.ToString)
End Try
... View more
11-23-2012
04:09 AM
|
0
|
0
|
1401
|
|
POST
|
You've initialized the array strArray, but does the commandInputDataCmd do anything with the array? You're not doing any checking to see if strArray has any elements in it.
Dim strArray As String()
If strArray Is Nothing Then
MsgBox("Empty")
Else
Dim num2 As Integer = (strArray.Length - 1)
End If
... View more
11-19-2012
05:18 AM
|
0
|
0
|
1401
|
|
POST
|
You almost had it. You only have to add in one column to the vt table (since this tool doesn't require the Ranks input for each feature class like the Intersect tool you asked about before) and add rows with the feature classes. Here's an example that works, written in VB.NET Dim GP As New ESRI.ArcGIS.Geoprocessor.Geoprocessor Dim vt = New ESRI.ArcGIS.Geoprocessing.GpValueTableObject Dim FC1 As ESRI.ArcGIS.Geodatabase.IFeatureClass Dim FC2 As ESRI.ArcGIS.Geodatabase.IFeatureClass Dim pLayer As ESRI.ArcGIS.Carto.ILayer2 Dim pFLayer As ESRI.ArcGIS.Carto.IFeatureLayer Dim params = New ESRI.ArcGIS.esriSystem.VarArray Try vt.SetColumns(1) pLayer = My.ArcMap.Document.FocusMap.Layer(0) pFLayer = New ESRI.ArcGIS.Carto.FeatureLayer pFLayer = pLayer FC1 = pFLayer.FeatureClass pLayer = My.ArcMap.Document.FocusMap.Layer(1) pFLayer = New ESRI.ArcGIS.Carto.FeatureLayer pFLayer = pLayer FC2 = pFLayer.FeatureClass vt.AddRow(FC1) vt.AddRow(FC2) params.Add(vt) params.Add("Polymerged") GP.Execute("FeatureToPolygon_management", params, Nothing) 'here's another way to do it. You have to add the ESRI.ArcGIS.DataManagementTools reference 'using the Add Reference dialog Dim F2P As New ESRI.ArcGIS.DataManagementTools.FeatureToPolygon F2P.in_features = vt F2P.out_feature_class = "poly1" GP.Execute(F2P, Nothing) Catch ex As Exception System.Windows.Forms.MessageBox.Show(ex.ToString) End Try End Sub
... View more
11-13-2012
11:17 AM
|
0
|
0
|
810
|
|
POST
|
You can set the IGeoProcessor::AddOutputstoMap property to false.
... View more
11-07-2012
01:53 PM
|
0
|
0
|
748
|
| 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 |
a month ago
|