POST
|
Is the ability to import and export traverse files still in the queue for the Pro 2.5 release?
... View more
09-26-2019
04:57 AM
|
2
|
1
|
663
|
POST
|
I had wanted to add some other points for reference, so I added an xy table, right clicked it and selected "Display XY Data" which opened the geoprocessing tool "XY Table To Point". Processing halted and it displayed "Tool is not licensed" below the title bar in Geoprocessing. Isn't this a base function?
... View more
09-10-2019
10:38 AM
|
0
|
1
|
385
|
POST
|
I had experienced the same issue. What I had found was that when I created the view, I had to exclude the Shape field, then I was able to add in and edit the view. Note that this was not a versioned feature layer. Dale
... View more
02-04-2019
06:50 AM
|
1
|
0
|
577
|
POST
|
I am using Collector which is hitting an SDE database. When I am creating a new polygon in the field, it won't save the polygon but keeps attributes. It doesn't matter whether I am using iOS or Android; or whether I go around in a clockwise or counter-clockwise direction. In iOS, as soon as I hit Submit, the polygon goes away, in Android, it fakes me out by staying there until the screen redraws. All attribute entries are stored in the SDE table. No problems with points, I have not attempted polylines lately. Android version 17.0.2, build 1028; iOS version 10.4.2, build 1559; SDE version 10.3.1; SQL Server 2014 (version 12.0.5000.0). Anyone else ever experienced and solved this? Thanks, Dale
... View more
07-19-2017
11:42 AM
|
0
|
0
|
315
|
POST
|
Ernie, I suspect that some of my issues stemmed from the .mxd I was using and others were due to my code. I hashed it out and got it to work. I did the migration away from VBA about two years ago with the release of 10. VB.Net seems to need everything fully defined, but I got the benefit of being able to create the AddIn, which makes distribution a whole lot easier. As budget is a perpetual issue, I use the (still free) Visual Studio Express VB, version 2010 (prior 2008 and 2005) since they installed 10.1 here. I think I linked to my other post which seemed to be related. Thanks, Dale
... View more
01-22-2013
06:12 AM
|
0
|
0
|
801
|
POST
|
Well, I can't speak to 10.0 with a huge dataset, since my 10.1 AddIn won't install, but I have gotten it to run in 10.1 successfully. Some of my issues seem to have been with the .mxd and other issues stemmed from my "superior" coding skilz. Anyway, it works and here it is (below), Dale Public Class btnGlobalReplace
Inherits ESRI.ArcGIS.Desktop.AddIns.Button
Public Sub New()
m_App =
My.ArcMap.Application
End Sub
Protected Overrides Sub OnClick()
'This routine "btnGlobalReplace" was written with the premise that the user would have a selection of features in a layer
'that need to have a specified value placed in a specific field. This routine will overwrite the existing value with a
'user specified value. Its original purpose was to clean up "noise" in LIDAR data for groundwater modeling purposes.
'Written/Assembled by Dale Bridgford 1/16/2013
Dim pMap As ESRI.ArcGIS.Carto.IMap
Dim pMxDoc As ESRI.ArcGIS.ArcMapUI.IMxDocument = My.ArcMap.Document
pMap = pMxDoc.FocusMap
' point to the active map(data frame)
Dim pLayer As ESRI.ArcGIS.Carto.ILayer = pMxDoc.SelectedLayer
If pLayer Is Nothing Then
MsgBox("No layer selected!! Select one point layer from the Table of Contents")
GoTo Clean_UP_Early
End If
Dim pFeatureLayer As ESRI.ArcGIS.Carto.IFeatureLayer = CType(pLayer, ESRI.ArcGIS.Carto.IFeatureLayer)
Dim pFeatureSelection As ESRI.ArcGIS.Carto.IFeatureSelection = CType(pLayer, ESRI.ArcGIS.Carto.IFeatureSelection)
Dim fields As ESRI.ArcGIS.Geodatabase.IFields = pFeatureLayer.FeatureClass.Fields
Dim field As ESRI.ArcGIS.Geodatabase.IField = Nothing
Dim a As Integer = fields.FieldCount - 1
Dim i As Integer = 0
Dim FieldName(a) As String, FieldType(a) As String
Dim txtTargetField As String = Nothing
Dim NumFeat As Integer = pFeatureSelection.SelectionSet.Count
Dim strReplacementValue As String = Nothing
Dim pSelectionSet As ESRI.ArcGIS.Geodatabase.ISelectionSet = pFeatureSelection.SelectionSet
Dim pFeatureClass As ESRI.ArcGIS.Geodatabase.IFeatureClass = pFeatureLayer.FeatureClass
Dim pID As New ESRI.ArcGIS.esriSystem.UIDClass()
Dim pEditor As ESRI.ArcGIS.Editor.IEditor
'Make sure a layer has been selected
'Acquire listing of all fields in the selected layer
a = 0
For a = 0 To fields.FieldCount - 1
field = fields.Field(a)
FieldName(a) = field.Name
FieldType(a) = field.Type
Next
txtTargetField = InputBox("Enter the Name of the Field to Update" & vbNewLine & "Be aware that field names are case sensitive!", "Field to Update")
i = 0
For i = 0 To fields.FieldCount - 1
If FieldName(i) = txtTargetField Then GoTo SideDoor
Next
MsgBox("Please open the attribute table and get the correct field name. Aborting", MsgBoxStyle.OkOnly, "Aborting")
GoTo Clean_Up_Early
SideDoor:
txtTargetField = FieldName(i)
Dim Value As String = ""
Select Case FieldType(i)
Case ESRI.ArcGIS.Geodatabase.esriFieldType.esriFieldTypeSmallInteger
Value = "Small Integer"
Case ESRI.ArcGIS.Geodatabase.esriFieldType.esriFieldTypeInteger
Value = "Long Integer"
Case ESRI.ArcGIS.Geodatabase.esriFieldType.esriFieldTypeSingle
Value = "Single-precision floating-point number"
Case ESRI.ArcGIS.Geodatabase.esriFieldType.esriFieldTypeDouble
Value = "Double-precision floating-point number"
Case ESRI.ArcGIS.Geodatabase.esriFieldType.esriFieldTypeString
Value = "Character string"
Case ESRI.ArcGIS.Geodatabase.esriFieldType.esriFieldTypeDate
Value = "Date"
Case ESRI.ArcGIS.Geodatabase.esriFieldType.esriFieldTypeOID
Value = "Long Integer representing an object identifier"
Case ESRI.ArcGIS.Geodatabase.esriFieldType.esriFieldTypeGeometry
Value = "Geometry"
Case ESRI.ArcGIS.Geodatabase.esriFieldType.esriFieldTypeBlob
Value = "Binary Large Object, Blob Storage"
Case ESRI.ArcGIS.Geodatabase.esriFieldType.esriFieldTypeRaster
Value = "Raster"
Case ESRI.ArcGIS.Geodatabase.esriFieldType.esriFieldTypeGUID
Value = "Globally Unique Identifier"
Case ESRI.ArcGIS.Geodatabase.esriFieldType.esriFieldTypeGlobalID
Value = "ESRI Global ID"
Case ESRI.ArcGIS.Geodatabase.esriFieldType.esriFieldTypeXML
Value = "XML Document"
End Select
strReplacementValue = InputBox("Please enter the value to replace the selected values in the field " & txtTargetField _
& " of data type " & Chr(34) & Value & Chr(34) & "." _
& vbNewLine & vbNewLine & "Be aware that entering a value of the wrong data type will crash the routine!", "Replacement Value")
If strReplacementValue = "" Then
MsgBox("You entered a blank value. Routine is aborting")
GoTo Clean_Up_Early
End If
'Verify that a subset of the layer is selected
If NumFeat = 0 Then
MsgBox("Aborting. Routine needs to operate on a subset of the entire shapefile", MsgBoxStyle.Exclamation, "Select some features")
GoTo Clean_UP
End If
' Test to see if an Edit session is open.
pID.Value = "esriEditor.Editor"
pEditor = m_App.FindExtensionByCLSID(pID)
If pEditor.EditState = ESRI.ArcGIS.Editor.esriEditState.esriStateEditing Then
MsgBox("You are in an edit session! End your edit session and then try again.")
GoTo Clean_Up_Early
End If
' Set up for the progress bar
Dim dInterval As Double
Dim recordCounter As Long ' measure progress
Dim status_count As Integer
Dim psbar As ESRI.ArcGIS.esriSystem.IStatusBar
psbar = m_App.StatusBar
Dim pPro As ESRI.ArcGIS.esriSystem.IStepProgressor
pPro = psbar.ProgressBar
Dim pTrackCancel As ESRI.ArcGIS.esriSystem.ITrackCancel
Dim bContinue As Boolean
Dim iExitStrategy As Integer
pTrackCancel = New ESRI.ArcGIS.Display.CancelTracker
pTrackCancel.CancelOnKeyPress = True
'Portion of script to begin assigning uniform value to all selected entities.
Dim enumFeat As ESRI.ArcGIS.Geodatabase.IEnumFeature = Nothing
Dim selFeat As ESRI.ArcGIS.Geodatabase.IFeature
Dim enumFeatSet As ESRI.ArcGIS.Geodatabase.IEnumFeatureSetup
enumFeat = My.ArcMap.Document.FocusMap.FeatureSelection
enumFeatSet = enumFeat
enumFeatSet.AllFields = True
' Get the count of features and set up the progress bar
NumFeat = pFeatureSelection.SelectionSet.Count
dInterval = NumFeat / 100
pPro.MinRange = 1
pPro.MaxRange = NumFeat
pPro.StepValue = dInterval
recordCounter = 0
status_count = 0
pPro.Position = recordCounter
pPro.Message = "Reassigning values to " & NumFeat & " fields. (Press ESC, space bar, or mouse button to stop.)"
pPro.Step()
pPro.Show()
selFeat = enumFeat.Next
'Now loop thru all of the features
For recordCounter = 1 To NumFeat
selFeat.Value(selFeat.Fields.FindField(txtTargetField)) = strReplacementValue
selFeat.Store()
bContinue = pTrackCancel.Continue
If Not bContinue Then
iExitStrategy = MsgBox("Calculation Interrupted!" & vbNewLine & "The Escape key, space bar, or mouse button was pressed. Do you want to continue?", vbYesNo)
If iExitStrategy = vbNo Then
GoTo Interrupted
Else
pTrackCancel.CancelOnKeyPress = True
End If
End If
pPro.Position = recordCounter
pPro.Step()
pPro.Show()
selFeat = enumFeat.Next
If recordCounter = NumFeat Then GoTo Interrupted
Next
Interrupted:
pPro.Hide()
If iExitStrategy = vbNo Then
MsgBox("User Aborted mid-processing")
pMap.FeatureSelection.Clear()
Else : MsgBox("Finished, assigned values to " & NumFeat & " features.")
End If
Clean_UP:
'Clean up memory
field = Nothing
fields = Nothing
a = Nothing
bContinue = Nothing
dInterval = Nothing
enumFeat = Nothing
enumFeatSet = Nothing
FieldName = Nothing
FieldType = Nothing
i = Nothing
NumFeat = Nothing
pEditor = Nothing
pID = Nothing
pEditor = Nothing
pFeatureClass = Nothing
pFeatureLayer = Nothing
pID = Nothing
'pLayer = Nothing
'pMap = Nothing
'pMxDoc = Nothing
pPro = Nothing
psbar = Nothing
pSelectionSet = Nothing
pTrackCancel = Nothing
pTable = Nothing
recordCounter = Nothing
selFeat = Nothing
strReplacementValue = Nothing
pFeatureSelection.Clear()
pMap.FeatureSelection.Clear()
pMxDoc.ActiveView.Refresh()
Clean_Up_Early:
pLayer = Nothing
pMxDoc = Nothing
pMap = Nothing
GC.Collect()
End Sub
Protected Overrides Sub OnUpdate()
End Sub
End Class
... View more
01-22-2013
06:05 AM
|
0
|
0
|
331
|
POST
|
I did regenerate the AddIn in VB.Net 2008 for ArcMap 10.0 and it had initially failed, but it was due to an error on my part (resetting a variable and subsequently calling it), which I have corrected. At the time it failed, I submitted a crash report to ESRI with a link to this thread. If you're here reading from the 10.0 crash, it seems to work with small selections, however, I will be testing it Tuesday with the 200,000 point dataset in both 10.0 and 10.1. Thanks, Dale
... View more
01-19-2013
04:33 AM
|
0
|
0
|
331
|
POST
|
Mr. Salazar, Your issue sounds like mine, with the exception of we don't have SP1 installed yet. My routine will run successfully, but it either won't return ArcMap in a fully functional state or it will crash. I hope this can be figured out. In my case, it is highly possible that I have done things that aren't really acceptable in code and now it is coming back to bite me. Have a good weekend. Dale
... View more
01-18-2013
11:46 AM
|
0
|
0
|
801
|
POST
|
In the time since I initially posted, I have had the opportunity to use the script, and as many times as it will be non-responsive, it will crash. It is an AddIn that I had migrated from 10.0, written in VB.Net 2008 (Express). I have since rebuilt the AddIn in VB.Net 2010 (Express) with the same annoying results. It sounds like it shares similar issues with Mr. Salazar's post , although I have not got Service Pack 1, just straight ArcMap 10.1. It looks like the other 7 tools I've generated in my AddIn continue to work satisfactorily, so I am at a loss.
... View more
01-18-2013
11:40 AM
|
0
|
0
|
331
|
POST
|
Greetings, I have written and/or assembled a VB.Net routine (VS 2010 Express) that will take a user generated selection and overwrites a field's existing values with a user-provided value. Amazingly, it works. However, once the routine completes and I click in the Data Frame in ArcMap 10.1, ArcMap locks up and is non-responsive. Apparently, I have unleashed something in the process and I don't have the programming skills to reel it in before the routine completes. In Windows XP's Task Manager, ArcMap.exe and vbexpress.exe aren't showing huge memory usage or changes in memory, but something seems to be getting stuck somewhere. My code is below. Thanks in advance if anyone can see the error of my ways (not that I am using VB, please) and point it out to me. Thanks, Dale Protected Overrides Sub OnClick()
'This routine "btnGlobalReplace" was written with the premise that the user would have a selection of features in a layer
'that need to have a specified value placed in a specific field. This routine will overwrite the existing value with a
'user specified value.
'Written/Assembled by Dale Bridgford 1/16/2013
Dim pMap As ESRI.ArcGIS.Carto.IMap
Dim pMxDoc As ESRI.ArcGIS.ArcMapUI.IMxDocument = My.ArcMap.Document
Dim MapSpatialRef As ESRI.ArcGIS.Geometry.ISpatialReference
Dim pLayer As ESRI.ArcGIS.Carto.ILayer = pMxDoc.SelectedLayer
Dim pFeatureLayer As ESRI.ArcGIS.Carto.IFeatureLayer = CType(pLayer, ESRI.ArcGIS.Carto.IFeatureLayer)
Dim pFeatureSelection As ESRI.ArcGIS.Carto.IFeatureSelection = CType(pLayer, ESRI.ArcGIS.Carto.IFeatureSelection)
pMap = pMxDoc.FocusMap ' point to the active map(data frame)
MapSpatialRef = pMap.SpatialReference 'determine the data frame projection
'Make sure a layer has been selected
If pLayer Is Nothing Then
MsgBox("No layer selected!! Select one point layer from the Table of Contents")
'Exit Sub
GoTo Clean_UP
End If
pFeatureLayer = pMxDoc.SelectedLayer
'Acquire listing of all fields in the selected layer
Dim fields As ESRI.ArcGIS.Geodatabase.IFields = pFeatureLayer.FeatureClass.Fields
Dim field As ESRI.ArcGIS.Geodatabase.IField = Nothing
Dim a As Integer = fields.FieldCount - 1
Dim i As Integer = 0
Dim FieldName(a) As String, FieldType(a) As String
a = 0
For a = 0 To fields.FieldCount - 1
field = fields.Field(a)
FieldName(a) = field.Name
FieldType(a) = field.Type
Next
Dim txtTargetField As String = Nothing, txtTargetFieldType As String = Nothing
txtTargetField = InputBox("Enter the Name of the Field to Update" & vbNewLine & "Be aware that field names are case sensitive!", "Field to Update")
i = 0
For i = 0 To fields.FieldCount - 1
If FieldName(i) = txtTargetField Then GoTo SideDoor
Next
MsgBox("Please open the attribute table and get the correct field name. Aborting", MsgBoxStyle.OkOnly, "Aborting")
GoTo Clean_UP
SideDoor:
txtTargetField = FieldName(i)
Dim strReplacementValue As String = Nothing
txtTargetFieldType = FieldType(i)
strReplacementValue = InputBox("Please enter the value to replace the selected values in the field " & txtTargetField _
& " of data type " & txtTargetFieldType, "Replacement Value")
If strReplacementValue = "" Then
MsgBox("You entered a blank value. Routine is aborting")
GoTo Clean_UP
End If
'Verify that a subset of the layer is selected
If pFeatureSelection.SelectionSet.Count = 0 Then
MsgBox("Aborting. Routine needs to operate on a subset of the entire shapefile", MsgBoxStyle.Exclamation, "Select some features")
GoTo Clean_UP
End If
Dim pSelectionSet As ESRI.ArcGIS.Geodatabase.ISelectionSet = pFeatureSelection.SelectionSet
Dim pFeatureClass As ESRI.ArcGIS.Geodatabase.IFeatureClass = pFeatureLayer.FeatureClass
' Test to see if an Edit session is open.
Dim pID As New ESRI.ArcGIS.esriSystem.UIDClass()
Dim pEditor As ESRI.ArcGIS.Editor.IEditor
pID.Value = "esriEditor.Editor"
pEditor = m_App.FindExtensionByCLSID(pID)
If pEditor.EditState = ESRI.ArcGIS.Editor.esriEditState.esriStateEditing Then
MsgBox("You are in an edit session! End your edit session and then try again.")
GoTo Clean_UP
End If
' Set up for the progress bar
Dim lNumFeat As Long
Dim dInterval As Double
Dim recordCounter As Long ' measure progress
'Dim PauseTime, Start, Finish, TotalTime, i
Dim status_count As Integer
Dim psbar As ESRI.ArcGIS.esriSystem.IStatusBar
psbar = m_App.StatusBar
Dim pPro As ESRI.ArcGIS.esriSystem.IStepProgressor
pPro = psbar.ProgressBar
Dim pTrackCancel As ESRI.ArcGIS.esriSystem.ITrackCancel
Dim bContinue As Boolean
Dim iExitStrategy As Integer
pTrackCancel = New ESRI.ArcGIS.Display.CancelTracker
pTrackCancel.CancelOnKeyPress = True
'pQF = New QueryFilter
'pQF.WhereClause = ""
'pFeatCursor = pFeatureClass.Search(pQF, False)
'pFeature = pFeatCursor.NextFeature 'Select first polygon in shapefile
'Dim pGeometry As IGeometry
'Portion of script to begin assigning uniform value to all selected entities.
Dim enumFeat As ESRI.ArcGIS.Geodatabase.IEnumFeature = Nothing
Dim selFeat As ESRI.ArcGIS.Geodatabase.IFeature
Dim enumFeatSet As ESRI.ArcGIS.Geodatabase.IEnumFeatureSetup
enumFeat = My.ArcMap.Document.FocusMap.FeatureSelection
enumFeatSet = enumFeat
enumFeatSet.AllFields = True
'Dim pGeometry As IGeometry
' Get the count of features and set up the progress bar
lNumFeat = pFeatureSelection.SelectionSet.Count
dInterval = lNumFeat / 100
'PauseTime = 1
pPro.MinRange = 1
pPro.MaxRange = lNumFeat
pPro.StepValue = dInterval
'Now loop thru all of the features
recordCounter = 0
status_count = 0
pPro.Position = recordCounter
pPro.Message = "Reassigning values to " & lNumFeat & " fields. (Press ESC, space bar, or mouse button to stop.)"
pPro.Step()
pPro.Show()
selFeat = enumFeat.Next
'Do While Not selFeat Is Nothing
For recordCounter = 1 To lNumFeat
'MsgBox(selFeat.OID)
selFeat.Value(selFeat.Fields.FindField(txtTargetField)) = strReplacementValue
selFeat.Store()
bContinue = pTrackCancel.Continue
If Not bContinue Then
iExitStrategy = MsgBox("Calculation Interrupted!" & vbNewLine & "The Escape key, space bar, or mouse button was pressed. Do you want to continue?", vbYesNo)
If iExitStrategy = vbNo Then
'pPro.Hide()
GoTo Interrupted
Else
pTrackCancel.CancelOnKeyPress = True
End If
End If
pPro.Position = recordCounter
pPro.Step()
pPro.Show()
selFeat = enumFeat.Next
If recordCounter = lNumFeat Then GoTo Interrupted
Next
Interrupted:
pPro.Hide()
If iExitStrategy = vbNo Then
MsgBox("User Aborted mid-processing")
Else : MsgBox("Finished")
End If
Clean_UP:
'Clean up memory
pMxDoc = Nothing
pMap = Nothing
pLayer = Nothing
MapSpatialRef = Nothing
field = Nothing
fields = Nothing
a = Nothing
bContinue = Nothing
dInterval = Nothing
enumFeat = Nothing
enumFeatSet = Nothing
FieldName = Nothing
FieldType = Nothing
i = Nothing
lNumFeat = Nothing
pEditor = Nothing
pID = Nothing
MapSpatialRef = Nothing
pEditor = Nothing
pFeatureClass = Nothing
pFeatureLayer = Nothing
pFeatureSelection.Clear() ' = Nothing
pID = Nothing
pLayer = Nothing
pMap = Nothing
pMxDoc = Nothing
pPro = Nothing
psbar = Nothing
pSelectionSet = Nothing
pTrackCancel = Nothing
pTable = Nothing
recordCounter = Nothing
selFeat = Nothing
strReplacementValue = Nothing
GC.Collect()
End Sub
Protected Overrides Sub OnUpdate()
End Sub
End Class
... View more
01-17-2013
04:22 AM
|
0
|
3
|
639
|
POST
|
Well, I solved it. I ended up not using ESRI.ArcGIS.Geometry.IProximityOperator::QueryNearestPoint. Instead I used ESRI.ArcGIS.Carto.IIndexQuery::NearestFeature with completely different code than what I have listed above. Thanks for looking. Dale
... View more
12-16-2011
10:07 AM
|
0
|
0
|
162
|
POST
|
I realized that I did not state what it was I was using. ArcMap 10.0 SP3 and VB 2008. Thanks, Dale
... View more
12-16-2011
03:18 AM
|
0
|
0
|
162
|
POST
|
Hello, I am working (repeatedly) with two point shapefiles. For my current effort, one is based on a Surfer grid which has one point every 0.5 feet and measures 40 by 100 feet for a total of 16,200 points (the population). The other point file has varying number of points (the sample) that fall within the footprint of the population. What I want it to do is loop through the sample, and for each point, locate the closest point in the population and add each successive population point to a selected set which will later be exported to a new shapefile. Thanks for your time and any suggestions. Here is what I have so far. There is a break in the code at my current problem.
Protected Overrides Sub OnClick()
'this routine assumes that the layers have been loaded as the first layer and the second layer in the map
'the spatial references for both the layers need to be defined.
'Its purpose is to select points from a population (Surfer grid) based on points from a sample population
'generated in Visual Sample Plan. For example, in the Surfer grid of 16,200 points, it will cycle through
'and choose the point closest to one of the VSP generated points. Note, both grids should share the same
'basic footprint.
'References the project to the active dataframe
Dim pMxDoc As ESRI.ArcGIS.ArcMapUI.IMxDocument = My.ArcMap.Document
Dim m_application As ESRI.ArcGIS.Framework.IApplication = CType(Hook, ESRI.ArcGIS.Framework.IApplication)
Dim pMap As ESRI.ArcGIS.Carto.IMap
Dim pFind As ESRI.ArcGIS.Geometry.PointClass = Nothing
pMap = pMxDoc.FocusMap
'Set things up for Layer 0, the Sample Population Layer (e.g., VSP from above)
Dim pSampLayer As ESRI.ArcGIS.Carto.ILayer = pMap.Layer(0)
Dim pSampFLayer As ESRI.ArcGIS.Carto.IFeatureLayer = pSampLayer
Dim pSampFClass As ESRI.ArcGIS.Geodatabase.IFeatureClass = pSampFLayer.FeatureClass
Dim pSampFCursor As ESRI.ArcGIS.Geodatabase.IFeatureCursor
pSampFCursor = pSampFClass.Search(Nothing, True) ' getting the feature cursor for Layer A to cycle through it
'Set things up for Layer 1, the Population Layer (e.g., Surfer from above)
Dim pPopLayer As ESRI.ArcGIS.Carto.ILayer = pMap.Layer(1)
Dim pPopFLayer As ESRI.ArcGIS.Carto.IFeatureLayer = pPopLayer
Dim pPopFClass As ESRI.ArcGIS.Geodatabase.IFeatureClass = pPopFLayer.FeatureClass
Code failure happens on this next line. Crashes ArcMap.
Dim pPopNearest As ESRI.ArcGIS.Geometry.IProximityOperator = DirectCast(pPopLayer, ESRI.ArcGIS.Geometry.IProximityOperator)
Dim pPopSpatRef As ESRI.ArcGIS.Geometry.ISpatialReference = GetSpatialReferenceFromDataset(pPopLayer)
Dim pF As ESRI.ArcGIS.Geodatabase.IFeature = pSampFCursor.NextFeature
'Dim pSelPoint As ESRI.ArcGIS.Geometry.IPoint = Nothing 'Initializes the selected point
Dim pSelSet As ESRI.ArcGIS.Geometry.IPoint = New ESRI.ArcGIS.Geometry.PointClass
pSelSet.SpatialReference = pPopSpatRef
Do Until pF Is Nothing
Dim pSampPointFeature As ESRI.ArcGIS.Geometry.IPoint = pF.Shape
pPopNearest.QueryNearestPoint(pSampPointFeature, ESRI.ArcGIS.Geometry.esriSegmentExtension.esriNoExtension, pSelSet)
Skip:
pF = pSampFCursor.NextFeature
Loop
End Sub
Public Function GetMxDocument(ByVal application As ESRI.ArcGIS.Framework.IApplication) As ESRI.ArcGIS.ArcMapUI.IMxDocument
If application Is Nothing Then
Return Nothing
End If
Dim mxDocument As ESRI.ArcGIS.ArcMapUI.IMxDocument = (CType(application.Document, ESRI.ArcGIS.ArcMapUI.IMxDocument)) ' Explicit Cast
Return mxDocument
End Function
Thank you, Dale Bridgford
... View more
12-15-2011
10:26 AM
|
0
|
2
|
2036
|
POST
|
Duncan, Thanks for the reply. I will pursue that next week when I get a little time to revisit the project. Thanks, Dale
... View more
01-14-2011
07:38 AM
|
0
|
0
|
260
|
POST
|
Hi, I am trying to update some code from VB6 to VB.Net 2008 and have been generally successful. However, I come across an issue where, as it processes each polygon in the shapefile and implements the following code.
Dim lngExtRing as Integer
lngExtRing = pPolygon.ExteriorRingCount - 1
ReDim pExtRings(pPolygon.ExteriorRingCount - 1)
pPolygon.QueryExteriorRingsEx(pPolygon.ExteriorRingCount, pExtRings(0))
pExtRings(lngExtRing)
Once that code runs and you hover over the pExtRings portion of pExtRings(lngExtRing) for some polygons (not all), the first popup lists a ComObject but if you expand the plus, it indicates "Nothing". I have run this on a shapefile that has 5 polygons and the two polygons that it fails on have negative areas. There are two ways that might resolve this, but I don't know how to implement either. One was to reverse the orientation if the area was negative, but I tried that on a different shapefile and it still failed on a polygon that did not have a negative area. The other, perhaps better, approach would be to implement the RepairGeometry class of ESRI.ArcGIS.DataManagementTools, but I have no clue on how to make it happen. If anyone has any insight or examples of how to use RepairGeometry, I would certainly appreciate being enlightened. Thanks Dale
... View more
01-06-2011
03:31 AM
|
0
|
2
|
1388
|
Title | Kudos | Posted |
---|---|---|
1 | 02-04-2019 06:50 AM | |
2 | 09-26-2019 04:57 AM |
Online Status |
Offline
|
Date Last Visited |
01-20-2021
07:21 AM
|