LFVNnet - sindizzy/DSW GitHub Wiki

This code generates a random linestring from a coordinate array using the Geometry library then creates a line feature using the desktop library.

Imports DotSpatial.Data

Public Partial Class Form1
	
	Private Sub button1_Click(sender As Object, e As EventArgs)
		'Creates a random number generator
		Dim rnd As New Random()
		'creates a new coordiante array
		Dim c As Coordinate() = New Coordinate(35) {}
		'for loop that will generate 36 random numbers
		For i As Integer = 0 To 35
			c(i) = New Coordinate((rnd.NextDouble() * 360) - 180, (rnd.NextDouble() * 180) - 90)
		Next
		'creates a linestring from the coordinate array
		Dim ls As New LineString(c)
		'creates a feature from the linestring
		Dim f As New Feature(ls)
	End Sub
End Class