Sample code that demonstrates how to create a Multi Polygon Feature Set

Imports System.Spatial.Data
Imports System.Spatial.Geometries

Private Sub button1_Click(sender As Object, e As EventArgs)
	Dim rnd As New Random()
	Dim pg As Polygon() = New Polygon(99) {}
	Dim f As New Feature()
	Dim fs As New FeatureSet(f.FeatureType)
	For i As Integer = 0 To 99
		Dim center As New Coordinate((rnd.[Next](50) * 360) - 180, (rnd.[Next](60) * 180) - 90)
		Dim coord As Coordinate() = New Coordinate(49) {}
		For ii As Integer = 0 To 49
			coord(ii) = New Coordinate(center.X + Math.Cos((ii * 10) * Math.PI / 10), center.Y + (ii * 10) * Math.PI / 10)
		Next
		coord(35) = New Coordinate(coord(0).X, coord(0).Y)
		pg(i) = New Polygon(coord)
		fs.Features.Add(pg(i))
	Next
	fs.SaveAs("C:\Temp\test.shp", True)
End Sub

Last edited Jul 8, 2010 at 7:18 PM by AlamoMan, version 1