Ok... First off I am a first time user of forums EVER, so as you might imagine I have racked my brain to no end with not luck whatsoever. Also, I am not a very good programmer, just thought I should insert that in case some of you programming wizards are wondering why this code look so terrible.
Here is the setup;
I need for my user to be able to input multiple distances for a buffer (thus the Multiple Ring Buffer Tool)
I am using a text box a list box and a add button. Once the action button (Buffer) is activated the numbers in the list box are converted to a List(of Double).
Where my problem comes into play is the .Distances property. If my user enters 500 <list box row 0> and 1000 <list box row 1>
The buffer generates a single buffer with a distance of 500.1 instead of 2 entries per Feature i.e. 1 - 500, 2 - 1000.
I have tried what I think to be everything. Look at my code below; and I will explain more after the code.
<Code>
Public Sub MultipleRingBuffer(ByVal UBuffer As List(Of Double))
Dim GP As Geoprocessor = New Geoprocessor()
GP.OverwriteOutput = True
Dim out As String = "RISK_BUFFER_" & FCName 'FCName is populated from an earlier process in the program.
Dim look As String = """" & String.Join(",", UBuffer.ToArray) & """"
'' Create the tool process object.
Dim bufferTool As ESRI.ArcGIS.AnalysisTools.MultipleRingBuffer = New ESRI.ArcGIS.AnalysisTools.MultipleRingBuffer
With bufferTool
.Input_Features = Open.OpenFeatureClassFromString(path & name & ".gdb\" & FCName)
.Output_Feature_class = path & name & ".gdb\" & out
.Distances = look
.Buffer_Unit = "Feet"
.Field_Name = "INPUT_DISTANCES"
.Dissolve_Option = "NONE"
End With
RunTool(GP, bufferTool, Nothing)
End Sub
Private Sub RunTool(ByVal geoprocessor As Geoprocessor, ByVal process As IGPProcess, ByVal TC As ITrackCancel)
geoprocessor.OverwriteOutput = True
Try
geoprocessor.Execute(process, Nothing)
'ReturnMessages(geoprocessor)
Catch err As Exception
'Console.WriteLine(err.Message)
MessageBox.Show(err.Message)
End Try
End Sub
</Code>
look is the variable that I am using to push to the .Distances Property. Also Notice the UBuffer is being received from another part of the program.
What I have tried for the .Distances;
1. Passing UBuffer directly - .Distances = UBuffer (Did not Work)
2. Dim look As String = """" & String.Join(" ", UBuffer.ToArray) & """" Notice the <space>
3. Dim look As String = String.Join(",", UBuffer.ToArray) Notice the Missing """" at the begin and end of the string
4. Dim look As String = """" & String.Join(";", UBuffer.ToArray) & """" Notice the ";"
5. Dim look as Object = UBuffer - multiple iterations of this
This can go on and on... I suspect I am either completely wrong by using the above look variable or I have something minor wrong.
Thank you!
Here is the setup;
I need for my user to be able to input multiple distances for a buffer (thus the Multiple Ring Buffer Tool)
I am using a text box a list box and a add button. Once the action button (Buffer) is activated the numbers in the list box are converted to a List(of Double).
Where my problem comes into play is the .Distances property. If my user enters 500 <list box row 0> and 1000 <list box row 1>
The buffer generates a single buffer with a distance of 500.1 instead of 2 entries per Feature i.e. 1 - 500, 2 - 1000.
I have tried what I think to be everything. Look at my code below; and I will explain more after the code.
<Code>
Public Sub MultipleRingBuffer(ByVal UBuffer As List(Of Double))
Dim GP As Geoprocessor = New Geoprocessor()
GP.OverwriteOutput = True
Dim out As String = "RISK_BUFFER_" & FCName 'FCName is populated from an earlier process in the program.
Dim look As String = """" & String.Join(",", UBuffer.ToArray) & """"
'' Create the tool process object.
Dim bufferTool As ESRI.ArcGIS.AnalysisTools.MultipleRingBuffer = New ESRI.ArcGIS.AnalysisTools.MultipleRingBuffer
With bufferTool
.Input_Features = Open.OpenFeatureClassFromString(path & name & ".gdb\" & FCName)
.Output_Feature_class = path & name & ".gdb\" & out
.Distances = look
.Buffer_Unit = "Feet"
.Field_Name = "INPUT_DISTANCES"
.Dissolve_Option = "NONE"
End With
RunTool(GP, bufferTool, Nothing)
End Sub
Private Sub RunTool(ByVal geoprocessor As Geoprocessor, ByVal process As IGPProcess, ByVal TC As ITrackCancel)
geoprocessor.OverwriteOutput = True
Try
geoprocessor.Execute(process, Nothing)
'ReturnMessages(geoprocessor)
Catch err As Exception
'Console.WriteLine(err.Message)
MessageBox.Show(err.Message)
End Try
End Sub
</Code>
look is the variable that I am using to push to the .Distances Property. Also Notice the UBuffer is being received from another part of the program.
What I have tried for the .Distances;
1. Passing UBuffer directly - .Distances = UBuffer (Did not Work)
2. Dim look As String = """" & String.Join(" ", UBuffer.ToArray) & """" Notice the <space>
3. Dim look As String = String.Join(",", UBuffer.ToArray) Notice the Missing """" at the begin and end of the string
4. Dim look As String = """" & String.Join(";", UBuffer.ToArray) & """" Notice the ";"
5. Dim look as Object = UBuffer - multiple iterations of this
This can go on and on... I suspect I am either completely wrong by using the above look variable or I have something minor wrong.
Thank you!