Good afternoon.
I just joined the group, since I am making a form in VBA, from which I want to show on a map the points loaded in a listbox as a result of a filter applied to a table.
I have taken the CreatePointShapefile.cs example from the MAPWINGIS.ORG site page, however, I have not been able to get it to work for me, even though running it does not throw me any errors, showing me only the last point inserted into the shapefile.
I enclose the code in VBA with which I am trying to do the above, thanking you in advance for any suggestion or help in this regard.
Dim sf As New Shapefile
Dim tmp As Boolean
tmp = sf.CreateNewWithShapeID("", ShpfileType.SHP_POINT)
Dim utils As New utils
Dim img As New MapWinGIS.Image
tmp = img.Open("C:\positioning icon.png", PNG_FILE, True)
With sf.DefaultDrawingOptions
.PointType = tkPointSymbolType.ptSymbolPicture
.Picture = img
.Visible = True
End With
tmp = Map2.AddLayer(sf, True)
Dim i As Long
Dim pnt As New MapWinGIS.Point
Dim shp As New MapWinGIS.Shape
Dim index As Long
For i = 0 To (ListBox1.ListCount - 1)
pnt.x = Val(ListBox1.List(i, 10)) 'Longitude
pnt.y = Val(ListBox1.List(i, 9)) 'Latitude
shp.Create (ShpfileType.SHP_POINT)
index = 0
tmp = shp.InsertPoint(pnt, index)
tmp = sf.EditInsertShape(shp, i)
Next i