Sample code that demonstrates how to create a Multi Line Feature

using DotSpatial.Data;
using DotSpatial.Geometries;

        private void button1_Click(object sender, EventArgs e)
        {
            Random rnd = new Random();
            Feature f = new Feature();
            FeatureSet fs = new FeatureSet(f.FeatureType);
            LineString[] ls = new LineString[2];
            for (int ii = 0; ii < 2; ii++)
            {
                Coordinate[] coord = new Coordinate[5];
                for (int i = 0; i < 5; i++)
                {
                    coord[i] = new Coordinate((rnd.NextDouble() * 360) - 180, (rnd.NextDouble() * 180) - 90);
                }
                ls[ii] = new LineString(coord);
            }
            MultiLineString mls = new MultiLineString(ls);
            f = new Feature(mls);
            fs.Features.Add(f);
            fs.SaveAs("C:\\Temp\\test.shp", true);
        }

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