Quantcast
Channel: DotSpatial
Viewing all articles
Browse latest Browse all 3973

New Post: M Values for points or lines

$
0
0
Yea I dont know how I missed that. If you could also advise me, I am trying to produce the same thing with a LineString Feature.

I basically am getting the same result. The Features are there, They show that they support Z and M, but during editing in ArcMap, those values are NaN.

I used the same approach from the Function you showed. Being constructed a little differntly, I also followed the "DotSpatial_4_Attributes Table.docx" document and modified it to what I though was correct.

Private Function AddPolyLineFeatureToShape(coords As List(Of Coordinate), columns As ObservableCollection(Of PointColumns)) As FeatureSet
   dim lineF As FeatureSet = New FeatureSet(FeatureType.Line)

    Try

        lineF.Projection = DotSpatial.Projections.KnownCoordinateSystems.Geographic.World.WGS1984
        lineF.CoordinateType = CoordinateType.Z

        For i = 0 To columns.Count - 1

            Dim column As DataColumn = New DataColumn(columns(i).ColumnName)
            Select Case columns(i).ColumnType

                Case Is = "String"
                    lineF.DataTable.Columns.Add(New DataColumn(columns(i).ColumnName, GetType(System.String)))

                Case Is = "Date"
                    lineF.DataTable.Columns.Add(New DataColumn(columns(i).ColumnName, GetType(System.DateTime)))

                Case Is = "Double"
                    lineF.DataTable.Columns.Add(New DataColumn(columns(i).ColumnName, GetType(System.Double)))

            End Select

        Next


    Dim lineArray As New List(Of Coordinate)
    Dim lineGeometry As LineString = New LineString(lineArray)
    Dim lineFeature As DotSpatial.Data.IFeature = lineF.AddFeature(lineGeometry)
    lineFeature.Coordinates.Add(New Coordinate(coords(0).X, coords(0).Y, coords(0).Z, coords(0).M))
    lineFeature.DataRow("Owner") = "THE OWNER"
    lineFeature.DataRow("OwnedSince") = Now.ToShortDateString
    Dim existingFeature As DotSpatial.Data.IFeature = lineF.Features(lineF.Features.Count - 1)

    For i = 0 To coords.Count - 1
     existingFeature.Coordinates.Add(New Coordinate(coords(i).X, coords(i).Y, coords(i).Z, coords(i).M))
    Next
    If (existingFeature.Coordinates.Count >= 2) Then
      lineF.InitializeVertices()
    End If


    lineF.SaveAs("D:\test.shp", True)
    Return lineF

    Catch ex As Exception
        MsgBox(ex.Message & ex.StackTrace)
        Return Nothing
    End Try

End Function

Viewing all articles
Browse latest Browse all 3973

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>