Creating a new linestring and calculating the length

using DotSpatial.Topology;
using DotSpatial.Common;

        private void btnLineString_Click(object sender, EventArgs e)
            //creates a new coordinate array
            Coordinate[] coords = new Coordinate[36];
            //creates a random point variable
            Random rnd = new Random();
            //a for loop that generates a new random X and Y value and feeds those values into the coordinate array
            for (int i = 0; i < 36; i++)
               coords[i] = new Coordinate((rnd.NextDouble() * 360) - 180, (rnd.NextDouble() * 180) - 90);
            //creates a new linstring from the array of coordinates
            LineString ls = new LineString(coords);
            //new variable for the length of the linstring
            Double length;
            length = ls.Length;
            //Displays the length of the linstring
            MessageBox.Show("The length of the linstring is: " + length);

Last edited Jan 20, 2011 at 5:00 PM by mudnug, version 4