This project is read-only.

add a point in mapwingis by mouse and save it to a shapefile using MapWinGIS v4.9.3.6 in

Sep 28, 2016 at 7:33 AM
Edited Sep 28, 2016 at 7:35 AM
Hi All,
I'm creating an application using MapWinGIS-v4.9.3.6-Win32 in by visual basic 2005
this is my first time to use axMapWinGIS in
I dragged the tool into my form and opened a map shapefile

I want a sample code to how to Place a point on map, save it to the shapefile. I saw subject like this through the discussions here but using c# and i didn't know any about c#. So Could you show me the sample code using, please?

many thanks
Oct 3, 2016 at 11:22 AM
are there any help?
Oct 4, 2016 at 2:06 PM
please I need help
Oct 9, 2016 at 8:46 AM
please I want to know how to add a point in mapwingis by mouse and save it to a shapefile using MapWinGIS v4.9.3.6 in
Oct 17, 2016 at 12:31 PM
You've send me some more details via e-mail:
Dim shp As New Shape
Dim sf1 As New Shapefile()
Dim x As Double
Dim y As Double

Map1.PixelToProj(e.x, e.y, x, y)
Dim pnt = New MapWinGIS.Point()
pnt.x = x
pnt.y = y
Dim index As Integer = sf1.NumShapes
shp.InsertPoint(pnt, index)

index = sf1.NumShapes

sf1.CreateNewWithShapeID("", ShpfileType.SHP_POINT)
sf1.EditInsertShape(shp, index)
Map1.AddLayer(sf1, True)
In this code I try to add points in a shapefile by mouse and I put this code in mouse down event but the problem is that i add every point in a different shapefile I want to put all the points I add by mouse in the Same shapefile. so could you revise my code and correct the the mistakes existed ,please.? I really got exhausted I tried to correct it but useless.
First. Did you read this

Next I see you create a new shapefile for every point: sf1.CreateNewWithShapeID("", ShpfileType.SHP_POINT)

What you need to do is create the shapefile once and add it to the map and save the layer handle.
Next in the OnMouseDown you get this shapefile again using Map1.GetShapefile(hndl):

Now add the new shape and do a redraw:

Here's a full example: