Sample code that demonstrates how to create a Mutli Polygon Feature

Imports DotSpatial.Data
Imports DotSpatial.Geometries

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

Last edited Jul 13, 2010 at 3:12 PM by AlamoMan, version 2