Creating a polyline shape without making it a multipart polyline, where does it goes wrong?

Sep 15, 2012 at 8:20 PM

I have a small dotspatial thingy which could is probably related to mapwingis as well...

My question is, how to generate a shape with ploylines and not one multipart polyline....?

What the code does is....generate a set of loose polylines into one shape where its coordinates is based on coordinates from a list... BakjesLijst... 

The red/pink part must be 2 coordinates as 1 only generates errors... (ofcourse)... but in this code it generates two lines at the same spot....  Any idea how to generate loose -1line-polylines into 1 shapefile....?

 

Private Sub Maak_BakjesShape(ByVal sFilename)
        REM ***************************************************************
        REM * Maak van de as een shapefile en voeg hem toe aan de layers
        REM ***************************************************************
        Try
            Dim count As Long
            Dim filename As String = Form1.txtPadFileNaam.Text & sFilename & "_DMC_bakjes.shp"
            Dim f As New Feature()
            Dim fs As New FeatureSet(f.FeatureType)
            'Voeg kolommen toe
            fs.DataTable.Columns.Add(New DataColumn("ID", GetType(System.Int32)))
            fs.DataTable.Columns.Add(New DataColumn("REDlinks", GetType(System.Int32)))
            fs.DataTable.Columns.Add(New DataColumn("REDrechts", GetType(System.Int32)))
            'Set projection
            fs.Projection = Form1.myVenster.Projection
            'FOr all polylines
            For count = 0 To BakjesLijst.Count - 1
                Dim coord As Coordinate() = New Coordinate(1) {}
                'Per polyline
                For i As Integer = 0 To 0
                    coord(i) = New Coordinate(BakjesLijst(count).X1bakje, BakjesLijst(count).Y1bakje)
                    coord(i + 1) = New Coordinate(BakjesLijst(count).X2bakje, BakjesLijst(count).Y2bakje)
                Next
                Dim ls As New LineString(coord)
                f = New Feature(ls)
                fs.Features.Add(f)
                ' now the resulting features knows what columns it has
                ' add values for the columns
                Dim feature As IFeature = fs.AddFeature(ls)
                Feature.DataRow.BeginEdit()
                Feature.DataRow("ID") = 1
                feature.DataRow("REDlinks") = 200
                feature.DataRow("REDrechts") = 23000
                Feature.DataRow.EndEdit()
            Next
            fs.SaveAs(filename, True)
            Form1.myVenster.AddLayer(filename)