How to Buffer a point

Dec 11, 2013 at 10:04 AM
I need assist how to create buffer shapefile point.i just can open the shape file here is my source code with VB.6

Private Sub cmdopenbuffer_Click()
Dim sf As New MapWinGIS.Shapefile
sf.Open ("")
Map1.AddLayer sf, True
End Sub
Coordinator
Dec 12, 2013 at 9:06 AM
Here's some code. Not tested!
And I'm a C# developer and not a VB.NET developer ;)
-- Open input shapefile:
Dim sf As New MapWinGIS.Shapefile
sf.Open ("") -- input shapefile

-- Create output shapefile
Dim sfBuffer As New MapWinGIS.Shapefile
--http://www.mapwindow.org/documentation/mapwingis4.8/group__shapefile__management.html#ga9501a0b966bccd163e66468d8b712bd3
sfBuffer.CreateNewWithShapeID("", ShpfileType.SHP_POLYGON)
-- Optional add additional fields
Dim i As Integer = 0
While i > sf.numShapes
    -- Create output shape:
       Dim shpBuffer As New MapWinGIS.Shape
       -- Buffer
       -- http://www.mapwindow.org/documentation/mapwingis4.8/class_shape.html#ad4063312b170dcee5f6065b3dfcef0d9
       shpBuffer = sf.Shape[i].Buffer(distance, 16)
      -- Add buffered shape to output shapefile:
      Dim index As Integer = sfBuffer.NumShapes;
      -- http://www.mapwindow.org/documentation/mapwingis4.8/group__shapefile__editing.html#ga818337589b47b96312bb01d67406f590
      If Not sfBuffer.EditInsertShape(shpBuffer, index) Then
          MessageBox.Show("Failed to insert shape: " + sfBuffer.ErrorMsg(sfBuffer.LastErrorCode))
          Return
      End If
      -- Optional: fill additional fields
End While

-- Optional save output to disk:
-- http://www.mapwindow.org/documentation/mapwingis4.8/group__shapefile__management.html#gadac0d7528183a1a272231c4ddfdce627
sfBuffer.SaveAs()

-- Add shapefiles to map:
Map1.AddLayer sf, True 
Map1.AddLayer sfBuffer, True 
Marked as answer by mohammad_ardha on 12/13/2013 at 7:03 PM
Dec 14, 2013 at 2:03 AM
Thannks Your assist because I am a beginner for programming especially for mapwingis.my basic education is geography so this script is helpful me.