This project is read-only.
Sample code that will generate random an array of coordinates, creates a linestring from the array of coordinates, and calculates the length of the linestring.

using DotSpatial.Geometries;
using DotSpatial.Topology.Geometries;

   public void PolgygonHolesSC()
        {
            //Creates a coordinate arrary
            Coordinate[] coords = new Coordinate[36];
            //Creates a random number generator
            Random rnd = new Random();
            //A for loop that will generate random coordinate's and add those coordinates to the array
            for (int i = 0; i < 36; i++)
            {
                coords[i] = new Coordinate((rnd.NextDouble() * 360) - 180, (rnd.NextDouble() * 180) - 90);

            }
            //Creates a linestring from the array of coordinates
            LineString ls = new LineString(coords);
            //Calculates the length of the linestring
            Double length;
            length = ls.Length;
 
        }

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