This project is read-only.

error create 2 shape file on memory(not save on HDD)

Apr 22, 2012 at 7:12 AM

-I use sf.CreateNewWithShapeID("", MapWinGIS.ShpfileType.SHP_POLYLINE) for make
shape file on memory(not save on disk)
-After i add table ,line shape to sf for and show on map ,everything work perfect
-I continue add sf2.CreateNewWithShapeID("", MapWinGIS.ShpfileType.SHP_POLYGON) on map for make file on memory(I have 2 shape file on memory)
-After i add polygon to sf2 anh show on map but lineshape of sf don't show on map only polygon shape of sf2 on map
-I change sf to sf.CreateNewWithShapeID("C:\Test.shp", MapWinGIS.ShpfileType.SHP_POLYGON)

-After run my progame but can't see lineshape on sf on Map only polygon .Open c:\test.shp with MapWindow GIS it work perfect. I can see line shape on MapWindow GIS

-Here my simple my program .Paste on Form load
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim fs As MapWinGIS.Field
Dim sf As New MapWinGIS.Shapefile
Dim result As Boolean
Dim pnt1 As New MapWinGIS.Point
Dim pnt2 As New MapWinGIS.Point
Dim shp As New MapWinGIS.Shape

Dim tt As Integer

fs = New MapWinGIS.Field
fs.Name = "Name"
fs.Type = MapWinGIS.FieldType.STRING_FIELD
fs.Width = 20
'add layer leadingline
result = sf.CreateNewWithShapeID("", MapWinGIS.ShpfileType.SHP_POLYLINE)
result = sf.EditInsertField(fs, 1)
result = sf.StopEditingTable
AxMap1.AddLayer(sf, True)

pnt1.x = 99
pnt1.y = 19
pnt2.x = 99
pnt2.y = 19 + 0.01
tt = sf.NumShapes
result = sf.StartEditingShapes(True)
result = shp.Create(MapWinGIS.ShpfileType.SHP_POLYLINE)
result = shp.InsertPoint(pnt1, 0)
result = shp.InsertPoint(pnt2, 1)
tt = sf.NumShapes
result = sf.EditInsertShape(shp, tt)

result = sf.StartEditingTable
result = sf.EditCellValue(0, tt, "test")
AxMap1.ZoomToShape(0, 0)

Dim sf3 As New MapWinGIS.Shapefile
Dim pnt3 As New MapWinGIS.Point
Dim pnt4 As New MapWinGIS.Point
Dim shp2 As New MapWinGIS.Shape

sf3.CreateNewWithShapeID("", MapWinGIS.ShpfileType.SHP_POLYLINE)
pnt3.x = 99 + 0.009
pnt3.y = 19 + 0.005
pnt4.x = 99 - 0.001
pnt4.y = 19 - 0.002

tt = sf.NumShapes
result = sf3.StartEditingShapes(True)
result = shp.Create(MapWinGIS.ShpfileType.SHP_POLYLINE)
result = shp.InsertPoint(pnt1, 0)
result = shp.InsertPoint(pnt3, 1)
result = shp.InsertPoint(pnt4, 2)
result = shp.InsertPoint(pnt1, 3)
result = sf3.EditInsertShape(shp, tt)

'sf3.SaveAs("c:\test.shp") for test on MapWindowGIS
AxMap1.AddLayer(sf3, True)

End Sub

Anyone know create 2 shapefile to memory (not save on disk)load on map and see 2 shapefile on map
Because load shapefile to RAM(memory) we can edit fast and load faster
Or this is a limit of Mapwingis.ocx only load 1 shapefile to memory or bug of Mapwingis ?
Thanks for read and sorry about my english